. Net send method (from reference)
public class SendEmail {//<summary>///E-mail: Configure to Web. config//</summary> <param name= "Strto" > Recipient account </param>//<param name= "Strsubject" > Theme </param>// /<param name= "strbody" > Content </param> public static void Sendsmtpemail (String strto, String strsubject, St Ring strbody) {var strsmtpserver = configurationmanager.appsettings["Strsmtpserver"]; var strfrom = configurationmanager.appsettings["Strfrom"]; var strfrompass = configurationmanager.appsettings["Strfrompass"]; if (string. IsNullOrEmpty (Strsubject)) {strsubject = configurationmanager.appsettings["Strsubject"]; } var client = new SmtpClient (strsmtpserver); Client. useDefaultCredentials = false; Client. Credentials = new NetworkCredential (strfrom, Strfrompass); Client. Deliverymethod = Smtpdeliverymethod.network; var message = new MailMessage (strfrom, Strto, Strsubject, strbody); Message. bodyencoding = Encoding.UTF8; Message. Isbodyhtml = true; Client. Send (message); }///<summary>//E-mail///</summary>/<param name= "Strsmtpserver" > If it is 163 mailbox, write: smtp.163.com </param>//<param name= "Strfrom" > Sender's account: [email protected] </param> <param name= "Strfrompass" > Sender Password: Use encrypted password </param>//<param name= "Strto" > Recipient account </par am>//<param name= "Strsubject" > Themes </param>//<param name= "strbody" > Content </param> public static void Sendsmtpemail (String strsmtpserver, String strfrom, String Strfrompass, String Strto, String strsubject, String strbody) {var client = new SmtpClient (strsmtpserver); Client. useDefaultCredentials= false; Client. Credentials = new NetworkCredential (strfrom, Strfrompass); Client. Deliverymethod = Smtpdeliverymethod.network; var message = new MailMessage (strfrom, Strto, Strsubject, strbody); Message. bodyencoding = Encoding.UTF8; Message. Isbodyhtml = true; Client. Send (message); } }
Attention points
1. Register a 163 mail (registration date: 2015-09-26)
Key step : Set STMP, after the successful setting, there will be an encrypted password, and only once to log down here as a password to use "that is the above method: Strfrompass"
Using an old mailbox can be sent without the need to set it up.
However, when the newly registered mailbox is sent: The email name is not available and other errors (remove the incoming mailbox @163.com and become another error)
2. Registration to send activation verification
Add <a href to the stitched characters .... You can implement a hyperlink.
Ideas:
First step: Add an exact URL to the href: for example: Http://www.xxx.com?id=1&datetime=2015-09-26 21:00
(You can set the [? ID:] To encrypt the process so that others do not understand it) "to add text in the <a> here or else people can not order </a>" "How to get? The contents of the ID can be viewed in my essay's library to get the link parameters of the article "
Step Two: Click on the link to jump back to the corresponding page on your site, you will be in this page to get the change data and processing.
"How to deal with not much to say, is nothing more than the number of fields marked in the account has been activated"
. Net send mail (registered to send mail activation) method and attention points