<p>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.</p>

<p>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?</p>

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

[{'answer_id': 44783, 'author': 'Nick Berardi', 'author_id': 17, 'author_profile': 'https://Stackoverflow.com/users/17', 'pm_score': 7, 'selected': True, 'text': '<p>What you want to do is use the AlternateViews property on the MailMessage</p>\n\n<p><a href="http://msdn.microsoft.com/en-us/library/system.net.mail.mailmessage.alternateviews.aspx" rel="noreferrer">http://msdn.microsoft.com/en-us/library/system.net.mail.mailmessage.alternateviews.aspx</a></p>\n'}, {'answer_id': 44877, 'author': 'Michael Stum', 'author_id': 91, 'author_profile': 'https://Stackoverflow.com/users/91', 'pm_score': 6, 'selected': False, 'text': '<p>The MSDN Documentation seems to miss one thing though, I had to set the content type manually, but otherwise, it works like a charm :-)</p>\n\n<pre><code>MailMessage msg = new MailMessage(username, nu.email, subject, body);\nmsg.BodyEncoding = Encoding.UTF8;\nmsg.SubjectEncoding = Encoding.UTF8;\n\nAlternateView htmlView = AlternateView.CreateAlternateViewFromString(htmlContent);\nhtmlView.ContentType = new System.Net.Mime.ContentType("text/html");\nmsg.AlternateViews.Add(htmlView);\n</code></pre>\n'}, {'answer_id': 1323191, 'author': 'Community', 'author_id': -1, 'author_profile': 'https://Stackoverflow.com/users/-1', 'pm_score': 5, 'selected': False, 'text': '<p>Just want to add that you can use defined constants <code>MediaTypeNames.Text.Html</code> and <code>MediaTypeNames.Text.Plain</code> instead of <code>"text/html"</code> and <code>"text/plain"</code>, which is always a preferable way. It\'s in <code>System.Net.Mime</code> namespace.</p>\n\n<p>So in the example above, it would be:</p>\n\n<pre><code>AlternateView htmlView = AlternateView.CreateAlternateViewFromString(htmlContent, null, MediaTypeNames.Text.Html);\n</code></pre>\n'}, {'answer_id': 1488359, 'author': 'Aric TenEyck', 'author_id': 74819, 'author_profile': 'https://Stackoverflow.com/users/74819', 'pm_score': 4, 'selected': False, 'text': "<p>I'm just going to put a note here for anyone that's having problems and finds their way to this page - sometimes, Outlook SMTP servers will reconvert outgoing email.  If you're seeing your plain-text body vanish entirely, and nothing but base64-encoded attachments, it might be because your server is reencoding the email.  Google's SMTP server does not reencode email - try sending through there and see what happens.</p>\n"}, {'answer_id': 38023731, 'author': 'user1852503', 'author_id': 1852503, 'author_profile': 'https://Stackoverflow.com/users/1852503', 'pm_score': 3, 'selected': False, 'text': '<p>On top of using AlternateViews views to add both the html and the plain text view, <strong>make sure you are not also setting the body of the Mail Message</strong> object.</p>\n\n<pre><code>// do not do this: \nvar msg = new MailMessage(model.From, model.To);\nmsg.Body = compiledHtml;  \n</code></pre>\n\n<p>As it will make your email contain the html content in both views, overriding the alternative views.</p>\n'}, {'answer_id': 46849524, 'author': 'Pieter', 'author_id': 5415024, 'author_profile': 'https://Stackoverflow.com/users/5415024', 'pm_score': 3, 'selected': False, 'text': "<p>For the people(like me) who've had the problem of gmail displaying the plaintext part instead of the html part.</p>\n\n<p>Gmail seems to always display the last part in your message.</p>\n\n<p>So if you've added the html part before your plain text part chances are gmail will always show the plain text variant.</p>\n\n<p>To fix this you can simply add the plain text part before your html part.</p>\n"}, {'answer_id': 72982827, 'author': 'FritsJ', 'author_id': 3065855, 'author_profile': 'https://Stackoverflow.com/users/3065855', 'pm_score': 0, 'selected': False, 'text': "<p>For anyone who bumped into this issue you might want to check if you have preheader tags in your html.</p>\n<p>In my html I've added a  tag with a phrase of &quot;Activate your client admin account by clicking the link.&quot;.</p>\n<p>It seems like gmail is flagging the phrase &quot;clicking the link&quot; after removing it, all my emails that has been sent, are going straight to the inbox.</p>\n"}]
['https://Stackoverflow.com/questions/44777', 'https://Stackoverflow.com', 'https://Stackoverflow.com/users/91/']