<System.net> <br/> <mailsettings> <br/> <! -- <SMTP from = "username@gmail.com" deliverymethod = "network"> <br/> <network host = "smtp.gmail.com" Password = "password" Port = "587" username = "username" /> --> <br/> <SMTP from = "username@163.com" deliverymethod = "network"> <br/> <network host = "smtp.163.com" Password = "password" Port =" 25 "username =" username "defaultcredentials =" false "/> <br/> </SMTP> <br/> </mailsettings> <br/> </system.net>
1. enablessl = true is required when Gmail mailbox is used, but I do not know how to set it in the web. config file. Solution: http://blogs.msdn.com/vikas/archive/2008/04/29/bug-asp-net-2-0-passwordrecovery-web-control-cannot-send-emails-to-ssl-enabled-smtp-servers.aspx <textarea cols="50" rows="15" name="code" class="c-sharp:nocontrols">The below code snippet can do the job .. <br/> protected void passwordrecoveryuncsendingmail (Object sender, mailmessageeventargs e) <br/>{< br/> system. net. mail. smtpclient smtpsender = new system. net. mail. smtpclient ("mail.google.com", 587); <br/> smtpsender. deliverymethod = system. net. mail. smtpdeliverymethod. network; <br/> smtpsender. credentials = new system. net. networkcredential ("username@gmail.com", "password"); <br/> smtpsender. enablessl = true; <br/> smtpsender. send (E. message); <br/> E. cancel = true; <br/>}</textarea>
2. When the 163 mailbox is used, set the defaultcredentials attribute. The default value is false. If it is set to true, the following error occurs: "The mailbox name is not allowed. Server Response: authentication is
Required, smtp10, dscowla7bcymza9jy1bucq --. 27234s2 1236231608 "error.