Tag Archives: System.Net.Mail

Sending SMTP Email with Advanced Features in Visual Basic.NET | Part 2 – Include Alternate eMail Views

Click Star to Rate Post
1 Star2 Stars3 Stars4 Stars5 Stars (5 votes, average: 3.80 out of 5)
 

This is Part 2 of the Sending Email using SMTP with Advanced Features series. The first series went over how to add multiple attachments to an email message for someone to download when they view your email. I suggest you check that article out at this web link. Also for the basics of sending Smtp emails you really should check out the article here.

This article will show how to send your email message with Alternative Views. For instance, you can send an HTML based email message and also include a Plain Text Only version in the same email. This can help ensure that the recipient(s) can view your email in case the email provider or client software only supports Text based emails and so on. All you need to do is make your html based message and the plain text only message, then add those views to the email message using the AlternateView class.

Note: I do want to mention that these series of articles only work with Visual Basic 2005, VB 2008, Visual Basic 2010 and Higher since I am using the class libraries under the System.NET.Mail namespace, which wasn’t added until .NET Framework 2.0 and higher which of course includes version 3.5, DotNet 4.0, and newer.

First of all to get started you will want an instance of a couple classes. I am using the same gmail based codes I used in the first advanced article for this series.

  • System.Net.Mail.SmtpClient
  • System.Net.Mail.MailMessage

Continue reading

Sending SMTP Email with Advanced Features in Visual Basic.NET | Part 1 – Adding Multiple Attachments

Click Star to Rate Post
1 Star2 Stars3 Stars4 Stars5 Stars (1 votes, average: 5.00 out of 5)
 

This is Part 1 of ‘Sending Email with Advanced Features’ which will show how you can send an email message and add not just one attachment, but pretty much as many attachments as you want. If you haven’t already, I recommend you check out this article I made on the basics of setting up and sending email using the System.NET.Mail SMTP feature in the DotNET Framework. The code I’m using is compatible with Visual Basic .NET 2005, VB 2008, and VB.NET 2010 since I’m using the classes under the System.NET.Mail namespace which is made available in the .NET 2.0, .NET 3.0, .NET 3.5, and the .NET 4.0 Frameworks. I am using SMTP and a Google GMail account to send the email message.

First of all to get started you will want a instance of a few classes. Below are the ones you’ll need to setup…

  • System.Net.Mail.SmtpClient
  • System.Net.Mail.MailMessage
  • System.Net.Mail.Attachment

Below are the variables I am using for the classes above..

Continue reading