#1
First, make sure you need to send the email before circumventing the
automagic stuff. If so you can use the sendingEmail to circumvent.
Make sure you include this:
e.Cancel = True
If not, you will send both yours and the one from the control. Here is a
routine I set up for test purposes (VB - normally I am C#, but it should be
easy enough to translate, if that is your desire):
Private Sub SendVerificationEmail(ByRef userName As String, ByVal
password As String, ByVal email As String)
Dim path As String = "~/emails/resetPassword.txt"
Dim reader As New StreamReader(Server.MapPath(path))
Dim fromAddress As String =
ConfigurationManager.AppSettings("ForgottenPasswordEmailAddress")
Dim toAddress As String = email
Dim subject As String = "Your Logon Information"
Dim message As String = reader.ReadToEnd()
'Yeah this sucks, but it is doing wrong otherwise
message = message.Replace("{userName}", userName)
message = message.Replace("{loginName}", userName)
message = message.Replace("{password}", password)
Dim msg As New MailMessage(fromAddress, toAddress, subject, message)
Dim smtp As New SmtpClient()
smtp.DeliveryMethod = SmtpDeliveryMethod.Network
smtp.Send(msg)
End Sub
The text in password.txt is:
Dear {userName},
Your MySite.com user name and password are :
Login Name : {loginName}
Generated Password : {password}
For security purposes, you should log in and reset your password as soon as
possible. Please log in using the above password and go to the Personal Menu
and click MyPassword. Use the above password for the old password and choose
a new password.
Thank you for using MySite.com.
You can alter this however you please.
--
Gregory A. Beamer
MVP, MCP: +I, SE, SD, DBA
Subscribe to my blog
http://feeds.feedburner.com/GregoryBeamer#
or just read it:
http://feeds.feedburner.com/GregoryBeamer
********************************************
| Think outside the box! |
********************************************