-------------------- Code ---------------------
Private void sengmill_net ()
{//. Net SMTP class for mail sending. Authentication and attachment addition are supported;
System. Web. Mail. mailmessage mailmsg = new system. Web. Mail. mailmessage ();
Mailmsg. From = This. tb_from.text.trim ();
Mailmsg. To = This. tb_to.text.trim ();
Mailmsg. Body = This. tb_mailbody.text.trim ();
Mailmsg. Subject = "test mail from Hz ";
/* Paste the attachment, ^ _ ^. It's too stupid;
If (this. att1.value. tostring (). Trim ()! = String. Empty)
Mailmsg. attachments. Add (new system. Web. Mail. mailattachment (this. att1.value. tostring (). Trim ()));
If (this. att2.value. tostring (). Trim ()! = String. Empty)
Mailmsg. attachments. Add (new system. Web. Mail. mailattachment (this. att2.value. tostring (). Trim ()));
If (this. att3.value. tostring (). Trim ()! = String. Empty)
Mailmsg. attachments. Add (new system. Web. Mail. mailattachment (this. att3.value. tostring (). Trim ()));
*/
Mailmsg. Fields. Add ("http://schemas.microsoft.com/cdo/configuration/smtpauthenticate", "1 ");
// Whether verification is required, usually required
Mailmsg. Fields. Add
("Http://schemas.microsoft.com/cdo/configuration/sendusername", "gallon_han ");
// User name in your mailbox
Mailmsg. Fields. Add ("http://schemas.microsoft.com/cdo/configuration/sendpassword", "91900 ");
// Your own email password
System. Web. Mail. smtpmail. smtpserver = This. tb_smtpserver.text.trim ();
System. Web. Mail. smtpmail. Send (mailmsg );
}
-------------------- Supplement --------
When sending a mass mail, you can separate the mail address list with "," and assign it to mailmessage. bcc (instead of mailmessage. ).