Advertisement
Guest User

help

a guest
Aug 15th, 2018
486
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 0.84 KB | None | 0 0
  1. using System;
  2. using System.Net;
  3. using System.Net.Mail;
  4.  
  5. namespace Examples.SmptExamples.Async
  6. {
  7.     public class SimpleAsynchronousExample
  8.     {
  9.         public static void Main(string[] args)
  10.         {
  11.             MailMessage mail = new MailMessage("AlexJamesShepler@gmail.com", "alexjshepler@live.com");
  12.             SmtpClient client = new SmtpClient();
  13.             client.Port = 465 ;
  14.             client.DeliveryMethod = SmtpDeliveryMethod.Network;
  15.             client.UseDefaultCredentials = false;
  16.             client.Credentials = new NetworkCredential("AlexJamesShepler@gmail.com", "password");
  17.             client.EnableSsl = true;
  18.             client.Host = "smtp.gmail.com";
  19.             mail.Subject = "this is a test email.";
  20.             mail.Body = "This is my test email body";
  21.             client.Send(mail);
  22.         }
  23.     }
  24. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement