Send Password Email : Password « Security « C# / C Sharp






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;
        }
    }
}

   
    
  








Related examples in the same category

1.Directory Services Change PasswordDirectory Services Change Password
2.Utility class for encrypting passwords and comparing two encrypted passwords.
3.Password Encrypter
4.Get Random Password Using GUID