C#qq e-Mail

Source: Internet
Author: User
Tags mailmessage smtpclient

    //The SMTP (Simple Mail Transport Protocol) basic message Transfer Protocol. Providing the SmtpClient class (System.Net.Mail) in the. NET Frameword Class Library, she provides a lightweight way to send SMTP e-mail messages. The Bcc property in the SmtpClient class is a collection of recipients that specify the CC of this e-mail message, which means that multiple delivery addresses can be made for each message. The Attachmenty property is also a collection that you can use to add multiple attachments to a message. Other classes used in sending messages are mostly//1.        The attachment class, which represents a file attachment, that allows text, streams, and files to be attached to an e-mail message. //2.        The MailAddress class that represents the e-mail address. //3. The MailMessage class that represents the e-mail message.         /// <summary>        ///send e-mail/// </summary>        /// <param name= "tomailaddress" >Recipient</param>        /// <param name= "Body" >Message Content</param>        /// <param name= "Subject" >Message Subject</param>        /// <param name= "path" >Path to Attachment</param>         Public voidSetemail (stringTomailaddress,stringBodystringSubjectstringpath) {SmtpClient mailclient=NewSmtpClient ("smtp.qq.com"); //mailclient.port = 465;Mailclient.enablessl =true; //Credentials Login SMTP server AuthenticationMailclient.credentials =NewNetworkCredential ("User name","Password"); MailMessage message=NewMailMessage (NewMailAddress ("[email protected]"),Newmailaddress (tomailaddress)); //message. Bcc.add (New MailAddress ("[email protected]"); //multiple recipients can be addedMessage. Body =body; Message. Subject=subject; if(Path! ="") {Attachment att=NewAttachment (@path); Message.               Attachments.Add (ATT);        } mailclient.send (message); }

C#qq e-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.