Use the powerful function of. Net to send emails

Source: Internet
Author: User
Tags mailmessage

MainCodeAs follows:

Using system. Web. mail;

String 9


String 6


Mailmessage mymail = new mailmessage ();

String 4


Mymail. To = ""; // recipient's email address

String 2


Mymail. From = ""; // the sender's email address

String 9


String 3


Mymail. bodyformat = mailformat. Text; // The Body encoding method of the email. You can select text or HTML.

String 4


Mymail. Priority = mailpriority. Normal; // mail priority

String 4


Mymail. Subject = "Hello. Testing !!! "; // The Mail title string 1

Mymail. Body = "just for fun, never mind !!!! "; // Body of the emailString 4

Smtpmail. Send (mymail); string 6

System. web. mail class. among them, mailmessage is the main class of email. finally, use the send method in the smtpmail class to send the mail. (Please start the SMTP service)

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: 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.