SMTP mail sent to join authentication information

Source: Internet
Author: User
Tags join mail mailmessage
Smtp
Note that the compilation can only be passed under VS2003.

System.Web.Mail.MailMessage mail=new System.Web.Mail.MailMessage ();

Define the sending address of a message
Mail. From= "aierong@126.com";

Define a receive address for a message
Set up a semicolon-delimited list of recipient e-mail addresses
Mail. To= "aierong@126.com";

To define a message's dark delivery address
Set up a semicolon-delimited list of e-mail addresses
Mail. Bcc= "a@126.com";

Define CC addresses for messages
Set up a semicolon-delimited list of e-mail addresses
Mail. Cc= "Abc@371.net;aaa@263.net";

Define the subject of a message
Mail. subject= ". NET Email";

Set the content type of the body of an e-mail message
Here we send in HTML format
Mail. bodyformat=system.web.mail.mailformat.html;

Set the body of an e-mail message
Mail. Body= "Go Go";

Set an attachment
System.Web.Mail.MailAttachment mailattachment=new System.Web.Mail.MailAttachment (@ "D:\abc.doc");

Attach a previous attachment to a message
Mail. Attachments.Add (mailattachment);

SMTP server
Authentication is required for many SMTP servers
System.web.mail.smtpmail.smtpserver= "smtp.126.com";

Verify
Mail. Fields.Add ("Http://schemas.microsoft.com/cdo/configuration/smtpauthenticate", "1");
Login Name
Mail. Fields.Add ("Http://schemas.microsoft.com/cdo/configuration/sendusername", "Aierong");
Login Password
Mail. Fields.Add ("Http://schemas.microsoft.com/cdo/configuration/sendpassword", "*******");

Send
System.Web.Mail.SmtpMail.Send (Mail);



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.