Simple Mail and Post Office Protocol for .Net (SmtPop)

MimeMessage Class

An RFC822 MimeMessage

For a list of all members of this type, see MimeMessage Members.

System.Object
   SmtPop.MimeMessage

public class MimeMessage

Thread Safety

Public static (Shared in Visual Basic) members of this type are safe for multithreaded operations. Instance members are not guaranteed to be thread-safe.

Example

This short sample send a mail in 7bit text

 public void SendSimpleMail()
 {
        string body = "This is a simple message for test";
        string subject = "A simple message for test";

            
        MimeMessage msg = new MimeMessage ();
            
        // build the address source and destination
        MailAddressList from = new MailAddressList ();
        from.Add (new MailAddress ("toto" ,"toto@toto.com"));
        msg.AddressFrom = from;
            
        MailAddressList to = new MailAddressList ();
        to.Add (new MailAddress (TestConstant.toadr));
        msg.AddressTo = to;
            
        msg.SaveAdr ();
            
        // build message
        msg.SetSubject (subject, MimeTransferEncoding.Ascii7Bit);
        msg.SetBody (body, MimeTransferEncoding.Ascii7Bit, MimeTextContentType.TextPlain);

        // send message
        SMTPClient smtp = new SMTPClient (TestConstant.host, TestConstant.portsmtp);
        smtp.Open ();
        smtp.SendMail (msg);
        smtp.Close ();
            
}

Requirements

Namespace: SmtPop

Assembly: smtpop (in smtpop.dll)

See Also

MimeMessage Members | SmtPop Namespace