private void sendUserUnlockNotifyMailToUser(string userCode, string company) { AdminMail mail = new AdminMail(); mail.From_address = System.Configuration.ConfigurationManager.AppSettings["USER_ADMIN_MAIL_SEND_ADDRESS"].ToString(); mail.To_address = getEmailOfUser(userCode, company); mail.Bcc_address = "*****@*****.**"; mail.Subject = "User Account Unlocked"; String BodyText; BodyText = "<html>" + "<head>" + "<title>User Password Reset</title>" + " <body> " + "<table>" + "<tr>" + "<td>" + " Your system account has been unlocked successfully." + "</td>" + "</tr>" + "<tr>" + "</tr>" + "<tr>" + "</tr>" + "</table>" + " </body> " + " </html>"; try { mail.Body = BodyText; mail.sendMail(); } catch (Exception ee) { ScriptManager.RegisterStartupScript(this, GetType(), "Message", "alert('Error while sending notification e-mail.');", true); } }
private void sendUserCreationMail(string userCode, string company, string newPwd) { AdminMail mail = new AdminMail(); mail.From_address = System.Configuration.ConfigurationManager.AppSettings["USER_ADMIN_MAIL_SEND_ADDRESS"].ToString(); mail.To_address = getEmailOfUser(userCode, company); mail.Bcc_address = "*****@*****.**"; mail.Subject = "System User Created"; string userSystems = ""; DataTable dtUserRoles = new DataTable(); dtUserRoles = loadSystemsOfUser(txtUserCode.Text, ddlCompany.SelectedValue); foreach (DataRow r in dtUserRoles.Rows) { userSystems = userSystems + r[4].ToString() + "</br>"; } String BodyText; BodyText = "<html>" + "<head>" + "<title>New user account created</title>" + " <body> " + "<table>" + "<tr>" + "<td colspan=\"2\">" + " System user details " + "</td>" + "</tr>" + "<tr>" + "<td>" + " User Name " + "</td>" + "<td>" + userCode + "</td>" + "</tr>" + "<tr>" + "<td>" + " Company " + "</td>" + "<td>" + company + "</td>" + "</tr>" + "<tr>" + "<td>" + " Password " + "</td>" + "<td>" + newPwd + "</td>" + "</tr>" + "<tr>" + "<td>" + " Systems " + "</td>" + "<td>" + userSystems + "</td>" + "</tr>" + "<tr>" + "<td colspan=\"2\">" + "Note: Above password is single time password and you must change it after your first login" + "</td>" + "</tr>" + "</table>" + " </body> " + " </html>"; try { mail.Body = BodyText; mail.sendMail(); } catch (Exception ee) { ScriptManager.RegisterStartupScript(this, GetType(), "Message", "alert('Error while sending notification e-mail.');", true); } }