this is regester form when the user Registered to the site, the site automatic send email account to activate the user(send email to user).
so when the user fill the form and click on Button it the have this error.
so what is the solution ??
Mailbox unavailable. The server response was: <peshangm@hotmail.com> No such user here
Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.
Exception Details: System.Net.Mail.SmtpFailedRecipientException: Mailbox unavailable. The server response was: <peshangm@hotmail.com> No such user here
Source Error:
Line 37: // Send the email
Line 38: SmtpClient SMTPServer = new SmtpClient();
Line 39: SMTPServer.Send(email);
Line 40:
Line 41: // Redirecto to What ever page
Source File: d:\www.News.com\Register.aspx.cs Line: 39
Stack Trace:
protected void RegisterUser_CreatedUser(object sender, EventArgs e)
{
string userName = RegisterUser.UserName;
string emailAddress = RegisterUser.Email;
// Lets get the user's id
Guid userId = (Guid)Membership.GetUser(userName).ProviderUserKey;
// Now lets create an email message
StringBuilder emailMessage = new StringBuilder();
emailMessage.Append("Thank you for creating an account with YourDomain.com");
emailMessage.Append("<br />");
emailMessage.Append("Please click the below link to activate your account <br />");
emailMessage.Append(string.Format("<a href='http://www.YourDomain.com/ActivateUser.aspx?userName{0}&Id={1}'>Activate {0} </a>", userName, userId.ToString()));
MailMessage email = new MailMessage();
email.From = new MailAddress("noReply@YourDomain.com");
email.To.Add(new MailAddress(emailAddress));
email.Subject = "Please activate your account with YourDomain";
email.Body = emailMessage.ToString();
email.IsBodyHtml = true;
// Send the email
SmtpClient client = new SmtpClient();
client.Send(email);
// Redirecto to What ever page
Response.Redirect("Default.aspx", true);
}
peshangm
Member
73 Points
137 Posts
Email Account Activation with ASP.NET Membership API
Nov 07, 2012 03:34 PM|LINK
Dear all
this is regester form when the user Registered to the site, the site automatic send email account to activate the user(send email to user).
so when the user fill the form and click on Button it the have this error.
so what is the solution ??
<%@ Page Language="C#" AutoEventWireup="true" CodeFile="Login.aspx.cs" Inherits="Login" %> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head runat="server"> <title>Login</title> </head> <body> <form id="form1" runat="server"> <div> <asp:Login ID="Login1" runat="server"> </asp:Login> <asp:CreateUserWizard ID="CreateUserWizard1" runat="server" oncreateduser="CreateUserWizard1_CreatedUser" DisableCreatedUser="true"> <WizardSteps> <asp:CreateUserWizardStep runat="server" /> <asp:CompleteWizardStep runat="server" /> </WizardSteps> </asp:CreateUserWizard> </div> </form> </body> </html>protected void RegisterUser_CreatedUser(object sender, EventArgs e) { string userName = RegisterUser.UserName; string emailAddress = RegisterUser.Email; // Lets get the user's id Guid userId = (Guid)Membership.GetUser(userName).ProviderUserKey; // Now lets create an email message StringBuilder emailMessage = new StringBuilder(); emailMessage.Append("Thank you for creating an account with YourDomain.com"); emailMessage.Append("<br />"); emailMessage.Append("Please click the below link to activate your account <br />"); emailMessage.Append(string.Format("<a href='http://www.YourDomain.com/ActivateUser.aspx?userName{0}&Id={1}'>Activate {0} </a>", userName, userId.ToString())); MailMessage email = new MailMessage(); email.From = new MailAddress("noReply@YourDomain.com"); email.To.Add(new MailAddress(emailAddress)); email.Subject = "Please activate your account with YourDomain"; email.Body = emailMessage.ToString(); email.IsBodyHtml = true; // Send the email SmtpClient client = new SmtpClient(); client.Send(email); // Redirecto to What ever page Response.Redirect("Default.aspx", true); }<system.net> <mailSettings> <smtp from="info@sulyweb.com" deliveryMethod="Network"> <network host="smtp.sulyweb.com" password="pass" userName="info@sulyweb.com" port="25" defaultCredentials="true" /> </smtp> </mailSettings> </system.net>Suly Web For It Solution.
peshangm
Member
73 Points
137 Posts
Re: Email Account Activation with ASP.NET Membership API
Nov 07, 2012 09:35 PM|LINK
help please
Suly Web For It Solution.
peshangm
Member
73 Points
137 Posts
Re: Email Account Activation with ASP.NET Membership API
Nov 08, 2012 08:27 AM|LINK
Dear all i found the solution
I changing config file like below, it is work do not have problem.
<system.net> <mailSettings> <smtp from="info@sulyweb.com" deliveryMethod="Network"> <network host="smtp.sulyweb.com" password="pass" userName="info@sulyweb.com" /> </smtp> </mailSettings> </system.net>Suly Web For It Solution.