Asp. Net send mail sample source code

Source: Internet
Author: User

Sending mail in a asp.net program no longer requires component support in the same way as an ASP, and the MailMessage and SmtpMail classes contained within the System.Web.Mail namespace of the. NET Framework base class can implement this functionality.

The following is the source code:
Mail.mailmessage message = new Mail.mailmessage ();
Message. from = "test@51aspx.com";
Message. to = "test@51aspx.com";
Message. Subject = "Sent to 51aspx Mail";
Message. BODY = "content";
Mail.SmtpMail.SmtpServer = "localhost";
Mail.SmtpMail.Send (message);


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.