发送邮件,HTML和纯文本的.NET [英] Sending a mail as both HTML and Plain Text in .net

查看:166
本文介绍了发送邮件,HTML和纯文本的.NET的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我是从我的C#应用​​程序发送邮件,使用SmtpClient。伟大的作品,但我必须决定,如果我要发送邮件以纯文本或HTML。我想知道,有没有办法同时发送?我想,这就是所谓的多部分。

I'm sending mail from my C# Application, using the SmtpClient. Works great, but I have to decide if I want to send the mail as Plain Text or HTML. I wonder, is there a way to send both? I think that's called multipart.

我GOOGLE了一下,但大多数的例子基本上没有使用SmtpClient而是由整个SMTP-体本身,这是一个有点吓人,所以我不知道如果事情是建立在.NET Framework 3.0?

I googled a bit, but most examples essentially did not use SmtpClient but composed the whole SMTP-Body themselves, which is a bit "scary", so I wonder if something is built in the .net Framework 3.0?

如果没有,是否有任何真的很好用的/强大的第三方库发送电子邮件?

If not, is there any really well used/robust Third Party Library for sending e-Mails?

推荐答案

你想要做的是使用AlternateViews财产上的MailMessage

What you want to do is use the AlternateViews property on the MailMessage

<一个href="http://msdn.microsoft.com/en-us/library/system.net.mail.mailmessage.alternateviews.aspx">http://msdn.microsoft.com/en-us/library/system.net.mail.mailmessage.alternateviews.aspx

这篇关于发送邮件,HTML和纯文本的.NET的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆