This is a known issue or you can also call it as product limitation. PasswordRecovery control read most of the settings from web.config file. Internally it uses System.Net.Mail to send out email, which does not support reading EnableSSL setting from web.config. This bring us into a situation where PasswordRecovery control cannot send emails to SSL enabled smtp servers.
So when a user tries to send a email to SSL enable server using PasswordRecovery control, he get the following error.
Error: The SMTP server requires a secure connection or the client was not authenticated. The server response was: 5.7.0 Must issue a STARTTLS command first. 32sm15616652wfa.13
There is no setting in Web.Config for System.Net.Mail (.net 2.0) that maps to EnableSSL property of System.Net.Mail.SmtpClient.
1) In the code behind, We need to consume PasswordRecovery1_SendingMail event of the web control
2) This event provide us access to Email Message being sent and also give us option to cancel the send operation
3) We will make a copy of this email message, and create a new instance of System.Net.Mail.SmtpClient
4) This time we have complete access to its properties and we can turn On/Off the EnableSSL setting
5) Lets set EnableSSL to true and send the email message to desired SMTP server
The below code snippet can do the job..
protected void PasswordRecovery1_SendingMail(object sender, MailMessageEventArgs e)
System.Net.Mail.SmtpClient smtpSender = new System.Net.Mail.SmtpClient(“mail.google.com”, 587);
smtpSender.DeliveryMethod = System.Net.Mail.SmtpDeliveryMethod.Network;
smtpSender.Credentials = new System.Net.NetworkCredential(“email@example.com”, “password”);
smtpSender.EnableSsl = true;
e.Cancel = true;
1) Configure a PasswordRecovery control
2) Provide all the settings in Web.Config, including username/password, server name, email sender and others
3) Try to send a recovery email when SMTP server requires SSL
This problem is related to System.Net.Mail and also documented here…
I am working on it and trying to get a fixed for the problem, but as most of the bugs there is no ETA 🙂