Check out the sample code below to
see just how easy it is to use the SMTP component of
EasyMail .Net Edition. But don't let the ease of use
fool you; the SMTP component is very powerful and
packed with features. The sample code on this page demonstrates the most basic features of
the SMTP component. Be sure to click on the "Other Samples" tab to find
more advanced samples.
| Sample Notes | | This sample demonstrates the basic functionality of the SMTP component that sends a message in plain text with an attachment. |
EmailMessage msgObj = new EmailMessage();
msgObj.From.Email="bobj@domain.com"; msgObj.From.Name="Bob Johnson";
msgObj.Recipients.Add("jdoe@domain.com", "John Doe", RecipientType.To);
msgObj.Subject="Subject"; msgObj.BodyParts.Add("Message body.", BodyPartFormat.Plain);
msgObj.Attachments.Add("c:\\attachment.txt");
SMTP smtpObj = new SMTP("mail.domain.com");
smtpObj.Send(msgObj);
|