Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- using System.Net;
- using System.Net.Mail;
- namespace Examples.SmptExamples.Async
- {
- public class SimpleAsynchronousExample
- {
- public static void Main(string[] args)
- {
- MailMessage mail = new MailMessage("AlexJamesShepler@gmail.com", "alexjshepler@live.com");
- SmtpClient client = new SmtpClient();
- client.Port = 465 ;
- client.DeliveryMethod = SmtpDeliveryMethod.Network;
- client.UseDefaultCredentials = false;
- client.Credentials = new NetworkCredential("AlexJamesShepler@gmail.com", "password");
- client.EnableSsl = true;
- client.Host = "smtp.gmail.com";
- mail.Subject = "this is a test email.";
- mail.Body = "This is my test email body";
- client.Send(mail);
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement