Creating a new mail message

Introduction to the Non-MIME and MIME messages

Email messages can generally be separated into two broad categories:

  • Non-MIME messages.
  • MIME messages.

Non-MIME messages

A non-MIME message refers to any message that is created in the original format defined in RFC822. These messages are generally made up of simple text and Uuencoded or Yencoded attachments.

MIME messages

MIME (Multipurpose Internet Mail Extensions) was defined to expand upon the original RFC822 message structure’s ability to transport files and the inability to create a complex-multipart message. These types of messages are usually recognizable by the “MIME-VERSION : 1.0″ header line and the MIME-boundary separating the parts of the message.

Since almost all email readers today are MIME compatible, it is recommended to create all messages as MIME messages. Create a non-MIME messages only if it is likely that the mail reader used to receive the message will be unable to read MIME.

The examples below show how to create a simple mail message using the UltimateMail component:

C#:

// Create a new instance of the MailMessage class.
MailMessage msg = new MailMessage();
msg.From.Add("john@somedomain.com");
msg.To.Add("someone@somedomain.com");
msg.Subject = "Hello";
msg.BodyText = "How are you?";

VB.NET:

' Create a new instance of the MailMessage class.
Dim msg As New MailMessage()
msg.From.Add("john@somedomain.com")
msg.To.Add("someone@somedomain.com")
msg.Subject = "Hello"
msg.BodyText = "How are you?"