Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- MailMessage mail = new MailMessage();
- SmtpClient SmtpServer = new SmtpClient("smtp.office365.com");
- mail.From = new MailAddress("admin@avantustraining.com");
- mail.Sender = new MailAddress("admin@avantustraining.com");
- mail.To.Add(To);
- mail.Subject = "Test Mail";
- mail.Body = "This is for testing SMTP mail from GMAIL";
- SmtpServer.Port = 587;
- SmtpServer.UseDefaultCredentials = false;
- SmtpServer.DeliveryMethod = SmtpDeliveryMethod.Network;
- SmtpServer.Credentials = new System.Net.NetworkCredential("engsooncheah@avantustraining.com", "Y#98chea");
- //SmtpServer.UseDefaultCredentials = false;
- SmtpServer.EnableSsl = true;
- SmtpServer.Send(mail);
- Label1.Text = "Mail Send";
- }
- catch(Exception ex)
- {
- Label1.Text=ex.ToString();
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement