void SendMail (string username, string password)
{
MembershipUser user = MembershipProviderInternal.GetUser (UserName, false);
if (user == null)
return;
ListDictionary dictionary = new ListDictionary ();
dictionary.Add ("<%USERNAME%>", username);
dictionary.Add ("<%PASSWORD%>", password);
MailMessage message = MailDefinition.CreateMailMessage (user.Email, dictionary, this);
MailMessageEventArgs args = new MailMessageEventArgs (message);
OnSendingMail (args);
SmtpClient smtpClient = new SmtpClient ();
try {
smtpClient.Send (message);
} catch (Exception e) {
SendMailErrorEventArgs mailArgs = new SendMailErrorEventArgs (e);
OnSendMailError (mailArgs);
if (!mailArgs.Handled)
throw e;
}
}