private void Sengmill_net ()
{//.net SMTP class to send mail, support authentication, add attachments;
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";
* * Attachment of the paste, ^_^, stupid point;
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 the need to verify, generally is the
MailMsg. Fields.Add
("Http://schemas.microsoft.com/cdo/configuration/sendusername", "Gallon_han");
User name of your own mailbox
MailMsg. Fields.Add ("Http://schemas.microsoft.com/cdo/configuration/sendpassword", "218500");
Password for your own mailbox
System.Web.Mail.SmtpMail.SmtpServer = This.tb_smtpserver. Text.trim ();
System.Web.Mail.SmtpMail.Send (MailMsg);
}
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.