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

SMTPClient Class

This class sends a MimeMessage to an SMTP server

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

System.Object
   SmtPop.SMTPClient

public class SMTPClient

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 sample sends an e-mail

MimeMessage msg = new MimeMessage ();
string body = "This is a simple message for test";
string subject = "A simple message for test";

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 ();

msg.SetSubject (subject, MimeTransferEncoding.Ascii7Bit);
msg.SetBody (body, MimeTransferEncoding.Ascii7Bit, MimeTextContentType.TextPlain);

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

SMTPClient Members | SmtPop Namespace