From this example link below, the SendActivationEmail code is it on same page with the registration code or is it on different page?
Am also getting error
Server Error in '/' Application.
Unable to read data from the transport connection: net_io_connectionclosed.
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.IO.IOException: Unable to read data from the transport connection: net_io_connectionclosed.
Source Error:
Line 242: smtp.Credentials = NetworkCred;
Line 243: smtp.Port = 465;
Line 244: smtp.Send(mm);
Line 245: }
Line 246: }
C SHARP
using (MailMessage mm = new MailMessage(mail@gmail.com", txtEmail.Text))
{
mm.Subject = "Account Activation";
string body = "Hello " + txtUserName.Text.Trim() + ",";
body += "<br /><br />Please click the following link to activate your account";
body += "<br /><a href = '" + Request.Url.AbsoluteUri.Replace("Default.aspx", "UserActivation.aspx?ActivationCode=" + activationCode) + "'>Click here to activate your account.</a>";
body += "<br /><br />Thanks";
mm.Body = body;
mm.IsBodyHtml = true;
SmtpClient smtp = new SmtpClient();
smtp.Host = "smtp.gmail.com";
smtp.EnableSsl = true;
NetworkCredential NetworkCred = new NetworkCredential("mai@gmail.com", "<password>");
smtp.UseDefaultCredentials = true;
smtp.Credentials = NetworkCred;
smtp.Port = 465;
smtp.Send(mm);
}
}
}
see link below
https://www.aspsnippets.com/Articles/Send-user-Confirmation-email-after-Registration-with-Activation-Link-in-ASPNet.aspx