daily pastebin goal
70%
SHARE
TWEET

Untitled

cheahengsoon May 16th, 2018 150 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. MailMessage mail = new MailMessage();          
  2.             SmtpClient SmtpServer = new SmtpClient("smtp.office365.com");
  3.             mail.From = new MailAddress("admin@avantustraining.com");
  4.             mail.Sender = new MailAddress("admin@avantustraining.com");
  5.             mail.To.Add(To);
  6.             mail.Subject = "Test Mail";
  7.             mail.Body = "This is for testing SMTP mail from GMAIL";
  8.          
  9.  
  10.             SmtpServer.Port = 587;
  11.             SmtpServer.UseDefaultCredentials = false;
  12.             SmtpServer.DeliveryMethod = SmtpDeliveryMethod.Network;
  13.             SmtpServer.Credentials = new System.Net.NetworkCredential("engsooncheah@avantustraining.com", "Y#98chea");
  14.             //SmtpServer.UseDefaultCredentials = false;
  15.             SmtpServer.EnableSsl = true;
  16.  
  17.             SmtpServer.Send(mail);
  18.  
  19.             Label1.Text = "Mail Send";
  20.         }
  21.         catch(Exception ex)
  22.         {
  23.             Label1.Text=ex.ToString();
  24.         }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top