I am sending email to users with a verification link. But its not working. Bellow are my codes-
Join.aspx
<asp:CreateUserWizard ID="CreateUserWizard1" runat="server"
CompleteSuccessText="EON Profile Successfully Created. Please verify your email address to go ahead. Verification email with your password has been send to your email address."
oncreateduser="CreateUserWizard1_CreatedUser"
LoginCreatedUser="False"
onfinishbuttonclick="CreateUserWizard1_FinishButtonClick"
onnextbuttonclick="CreateUserWizard1_NextButtonClick"
OnSendingMail="CreateUserWizard1_SendingMail"
OnSendMailError="CreateUserWizard1_SendMailError"
AutoGeneratePassword="True" CreateUserButtonText="Finish"
oncontinuebuttonclick="CreateUserWizard1_ContinueButtonClick"
DuplicateUserNameErrorMessage="This Mobile Number Has Already Been Registered. Please enter a different Mobile Number."
CancelDestinationPageUrl="Default.aspx" ContinueDestinationPageUrl="Login.aspx"
DisableCreatedUser="True">
<p>Once you have visited the verification URL you will be redirected to the login page. For your reference, please find your login details below:</p>
<a href="http://eonext.com/Login.aspx" target="_blank">Member's Login Link</a>
<br />
Akter-Uddin
Member
88 Points
49 Posts
Email Verification link is not showing- OnSendingMail
Apr 25, 2012 05:42 AM|LINK
I am sending email to users with a verification link. But its not working. Bellow are my codes-
Join.aspx
<asp:CreateUserWizard ID="CreateUserWizard1" runat="server"
CompleteSuccessText="EON Profile Successfully Created. Please verify your email address to go ahead. Verification email with your password has been send to your email address."
oncreateduser="CreateUserWizard1_CreatedUser"
LoginCreatedUser="False"
onfinishbuttonclick="CreateUserWizard1_FinishButtonClick"
onnextbuttonclick="CreateUserWizard1_NextButtonClick"
OnSendingMail="CreateUserWizard1_SendingMail"
OnSendMailError="CreateUserWizard1_SendMailError"
AutoGeneratePassword="True" CreateUserButtonText="Finish"
oncontinuebuttonclick="CreateUserWizard1_ContinueButtonClick"
DuplicateUserNameErrorMessage="This Mobile Number Has Already Been Registered. Please enter a different Mobile Number."
CancelDestinationPageUrl="Default.aspx" ContinueDestinationPageUrl="Login.aspx"
DisableCreatedUser="True">
...
<MailDefinition
From="mailer.eonext@gmail.com"
IsBodyHtml="true"
Priority="Low"
BodyFileName="./welcome.htm"
Subject="EONext Membership Information" CC="info@eonext.com">
<EmbeddedObjects>
<asp:EmbeddedMailObject Name="LogoImage" Path="./images/logo.png" />
</EmbeddedObjects>
</MailDefinition>
Join.aspx.cs
protected void CreateUserWizard1_SendingMail(object sender, MailMessageEventArgs e) { // Get the UserId of the just-added user MembershipUser newUser = Membership.GetUser(CreateUserWizard1.UserName); Guid newUserId = (Guid)newUser.ProviderUserKey; // Determine the full verification URL (i.e., http://yoursite.com/Verification.aspx?ID=...) string urlBase = Request.Url.GetLeftPart(UriPartial.Authority) + Request.ApplicationPath; string verifyUrl = "/Verification.aspx?ID=" + newUserId.ToString(); string fullUrl = urlBase + verifyUrl; // Replace <%VerificationUrl%> with the appropriate URL and querystring e.Message.Body = e.Message.Body.Replace("<%VerificationUrl%>", fullUrl); //Check ssl for email sending SmtpClient mySmtpClient = new SmtpClient(); mySmtpClient.EnableSsl = true; mySmtpClient.Send(e.Message); e.Cancel = true; var sendTo = CreateUserWizard1.Email;// RegisterUser.Email; if (string.IsNullOrEmpty(sendTo)) { sendTo = "info@eonext.com"; e.Message.To.Add(sendTo); } }welcome.html
Message body-
Membership Confirmation Link: </p>
<a href="<%VerificationUrl%>"><%VerificationUrl%></a>
<br />
<p>Once you have visited the verification URL you will be redirected to the login page. For your reference, please find your login details below:</p>
<a href="http://eonext.com/Login.aspx" target="_blank">Member's Login Link</a>
<br />
<p></p>
<table>
</tr>
<tr><td>
<b>EONext ID:</b>
</td>
<td>
<%UserName%>
</td>
</tr>
<tr>
<td>
<b>Password:</b>
</td>
<td>
<%Password%>
</td>
</table>
Coding reference-http://www.asp.net/web-forms/tutorials/security/admin/unlocking-and-approving-user-accounts-cs
Chittagong, Bangladesh.
---------------------------------------------------------------------------
Nothing is permanent in this world...not even your problems.
nijhawan.sau...
All-Star
16460 Points
3178 Posts
Re: Email Verification link is not showing- OnSendingMail
Apr 25, 2012 05:48 AM|LINK
Not working?
What is not working?
Akter-Uddin
Member
88 Points
49 Posts
Re: Email Verification link is not showing- OnSendingMail
Apr 25, 2012 05:51 AM|LINK
Verification url into the email is not showing... see bellow picture...
Chittagong, Bangladesh.
---------------------------------------------------------------------------
Nothing is permanent in this world...not even your problems.
nijhawan.sau...
All-Star
16460 Points
3178 Posts
Re: Email Verification link is not showing- OnSendingMail
Apr 25, 2012 06:25 AM|LINK
If usernmae and pwd are diaplying this 'd also work.
Can you paste the message template, i see something fishy here:
<%VerificationUrl%>">
Akter-Uddin
Member
88 Points
49 Posts
Re: Email Verification link is not showing- OnSendingMail
Apr 25, 2012 06:42 AM|LINK
Membership Confirmation Link: </p>
<a href="<%VerificationUrl%>"><%VerificationUrl%></a>
<br />
also not working after removig <a href...
Chittagong, Bangladesh.
---------------------------------------------------------------------------
Nothing is permanent in this world...not even your problems.