/// <summary> /// Sends an email to user specifying that their account was tried to be re-activated /// </summary> /// <param name="to"></param> /// <param name="username"></param> /// <param name="adminEmailsAllowed"> </param> /// <param name="newsletterEmailsAllowed"> </param> /// <returns></returns> public bool SendReactivaitonNotificationEmail(string to, string username, bool adminEmailsAllowed) { if (adminEmailsAllowed) { _mailMessage = new MailMessage(_from, to); _mailMessage.Subject = EmailContents.ReactivationNotificationSubject; _mailMessage.Body = EmailContents.GetReactivationNotificationEmail(username); _smtpClient.SendAsync(_mailMessage, null); return(true); } return(false); }
/// <summary> /// Sends an email to the potential user that specifies that they have just cancelled their activation /// </summary> /// <param name="to"></param> /// <param name="username"></param> /// <param name="adminEmailsAllowed"> </param> /// <param name="newsletterEmailsAllowed"> </param> /// <returns></returns> public bool SendCancelActivationEmail(string to, string username, bool adminEmailsAllowed) { if (adminEmailsAllowed) { _mailMessage = new MailMessage(_from, to); _mailMessage.Subject = EmailContents.CancelActivationSubject; _mailMessage.Body = EmailContents.GetCancelActivationEmail(username); // Until the previous email sending operation is in process, wait otherwise exception will be thrown. while (_sendingInProgress) { Thread.Sleep(500); } _smtpClient.SendAsync(_mailMessage, null); _sendingInProgress = true; return(true); } return(false); }