Mega Code Archive

 
Categories / C# / Security
 

Send Password Email

using System; using System.Collections.Generic; using System.Linq; using System.Text; namespace WebOssApplications.Common {     public static class EmailUtility     {         public static bool SendPasswordEmail(string email, string password)         {             try             {                 System.Net.Mail.MailMessage mail = new System.Net.Mail.MailMessage(email, "registrar@weboss.com");                 mail.Subject = "You WebOss Password";                 mail.Body = "Your WebOss account password is " + password;                 System.Net.Mail.SmtpClient clnt = new System.Net.Mail.SmtpClient();                 clnt.Send(mail);             }             catch (System.Net.Mail.SmtpException)             {                 return false;             }             return true;         }     } }