简体   繁体   中英

html newsletter email arriving as an attachment

I'm using C# to send email newsletters for subscribers. There's no problem with sending the email but some email clients like outlook and hotmail receive html newsletter as an attachment and the email body contains only plaintext with html tags removed and some clients like gmail receive the email just fine.

What actually creates this behavior? If i put just few html tags in to message outlook and hotmail shows the newsletter fine but as i put in more html elements my mail arrives as attachment.

I've been trying to find out how to make my email appear ok in most popular email clients like outlook but have had no success so far. Anyone care to enlighten me how this email + html stuff actually works?

请查看此答案中的Mailchimp和CampaignMonitor链接,这可能会对您有所帮助。

Since you don't provide any information about how you're using C# to send this email, we can only speculate about what you're doing and what the problem might be. It sounds like you might be using MailMessage.AlternateViews to send your HTML, but only have that one view. If you're not intending to send out a multipart/alternative message then you should simply set the MailMessage.Body to your HTML content with MailMessage.IsBodyHtml = true .

That being said: I make the assumptions I do because some email clients are smarter than others, and if the content-type header doesn't make sense they'll do their best to try to figure out what the nicest way to display the content is, each potentially trying something different. If, however, my assumptions are incorrect it would greatly help to know the code you're using to generate the email, and even an example of the message headers.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM