public static void SendEmail(string emailbody)
{
// Specify the from and to email address
MailMessage mailMessage = new MailMessage("priyanshpraveen222@gmail.com", "prvn018@gmail.com");
// Specify the email body
mailMessage.Body = emailbody;
// Specify the email Subject
mailMessage.Subject = "Exception";
// Specify the SMTP server name and post number
SmtpClient smtpClient = new SmtpClient("smtp.gmail.com", 587);
// Specify your gmail address and password
smtpClient.Credentials = new System.Net.NetworkCredential()
{
UserName = "priyanshpraveen222@gmail.com",
Password = ""
};
// Gmail works on SSL, so set this property to true
smtpClient.EnableSsl = true;
// Finall send the email message using Send() method
smtpClient.Send(mailMessage);
}
No comments:
Post a Comment