public string SendMail(string emailId, string UserName) { string status = string.Empty; DataSet dsLoginCredentials = new DataSet(); try { MailAddress SendFrom = new MailAddress("....", "...."); // to mailid from argument emailId MailAddress SendTo = new MailAddress(emailId); MailMessage MyMessage = new MailMessage(SendFrom, SendTo); MyMessage.Subject = "Login Credentials"; MyMessage.Body = "Dear " + UserName + " your user name for login :" + emailId + "\n" + " and Password : " + UserName; SmtpClient emailClient = new SmtpClient("smtp.gmail.com"); emailClient.Port = 25; emailClient.Credentials = new NetworkCredential("...", "...."); emailClient.EnableSsl = true; emailClient.Send(MyMessage); } catch (Exception ex) { status = "Mail Sending Failed"; } return status; }
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)