) Asp.net can implement identity authentication email sending Methods

Source: Internet
Author: User
Tags mailmessage
Public void Sendmail ()
{
// Instantiate the mailmessage object
System. Web. Mail. mailmessage mail = new system. Web. Mail. mailmessage ();
 
// Define the mail sending Address
Mail. From =" Aierong@126.com ";
 
// Define the email Receiving address
// Set a list of recipient email addresses separated by semicolons
Mail. To =" Aierong@126.com ";
 
// Define the mail's dark sending Address
// Set the list of email addresses separated by semicolons
Mail. bcc =" A@126.com ";
 
// Define the CC address of the email
// Set the list of email addresses separated by semicolons
Mail. Cc =" Abc@371.net aaa@263.net ";

// Define the subject of the email
Mail. Subject = ". Net email ";

// Set the email body content type
// Here we send the message in HTML Format
Mail. bodyformat = system. Web. Mail. mailformat. html;

// Set the email body
Mail. Body = "Go ";

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

// Add an attachment to the email
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);
}
Related Article

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.