Use C #. Net to send emails

Source: Internet
Author: User
Tags mailmessage

 

/**/ /// <Summary>
///Send email
/// </Summary>
Internal   Void Send ()
{
System. Web. Mail. mailmessage =   New Mailmessage ();

Mailmessage. From =   " Fmzzs@126.com " ;
Mailmessage. =   " Zhang Dawei " ;
Mailmessage. Subject =   " I am the topic " ;
Mailmessage. Body =   " I am content " ;
Mailmessage. CC =   " Zhang Ming " ;


Mailmessage. Fields. Add ( " Http://schemas.microsoft.com/cdo/configuration/smtpauthenticate " , " 1 " );

Mailmessage. Fields. Add
( " Http://schemas.microsoft.com/cdo/configuration/sendusername " , Myemailusername );
// User name in your mailbox
Mailmessage. Fields. Add ( " Http://schemas.microsoft.com/cdo/configuration/sendpassword " , Myemailpassword );
// Password of your mailbox
System. Web. Mail. smtpmail. smtpserver = " Smtp.126.com " ; // SMTP Server
System. Web. Mail. smtpmail. Send (mailmessage );

}

This method is a bit old for sending emails. It is the system of DOTNET 2.0. net space has a new sending method, because of the worry, so did not look. this should be the study notes, and I will study new ones next time.

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.