The passwordrecovery control sends mail configuration file web. config settings.

Source: Internet
Author: User
Tags smtpclient

<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.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.