private void sendingEmail(string pstrSendingEmails)
{
try
{
System.Net.Mail.MailMessage mail = new System.Net.Mail.MailMessage();
System.Net.NetworkCredential cred = new System.Net.NetworkCredential("irononechanaka@gmail.com", "password1");
string strEmails = "sahanganepola@yahoo.com";
mail.To.Add(strEmails);
mail.Subject = "Email from workflow ";
mail.From = new System.Net.Mail.MailAddress(strEmails);
mail.IsBodyHtml = true;
mail.Body = "hi dear friend";
System.Net.Mail.SmtpClient smtp = new System.Net.Mail.SmtpClient("smtp.gmail.com");
smtp.UseDefaultCredentials = false;
smtp.EnableSsl = true;
smtp.Credentials = cred;
smtp.Port = 587;
smtp.Send(mail);
}
catch (Exception ex)
{
}
}
No comments:
Post a Comment