C #. NET Call QQ Mailbox

Source: Internet
Author: User
Tags mailmessage smtpclient

 Public Static voidQqfs () {Try{mailmessage mm=NewMailMessage (); MailAddress Fromma=NewMailAddress ("[email protected]"); MailAddress Toma=NewMailAddress ("[email protected]",NULL); Mm. from=Fromma; //RecipientMm. To.add ("[email protected]"); //Mailbox HeaderMm. Subject ="Hello Dear:"; Mm. Isbodyhtml=true; //Message ContentMm. Body ="Hello Mr Meteor! "; //encoding format for contentMm. Bodyencoding =System.Text.Encoding.UTF8; //mm.                ReplyTo = Toma; //mm.                Sender =fromma; //mm. isbodyhtml = false;Mm. Deliverynotificationoptions =deliverynotificationoptions.onsuccess; Mm. Cc.                ADD (Toma); SmtpClient SC=NewSmtpClient (); NetworkCredential NC=NewNetworkCredential (); nc. UserName="[email protected]";//your e-mail addressnc. Password ="xxxxxxxx";//email password, the password is [email protected] Email password ~Sc. useDefaultCredentials =true; Sc. Deliverymethod=smtpdeliverymethod.network; Sc. Credentials=NC; //If this is reported to mail from address must is same as authorization user this error, is your QQ mailbox does not open SMTP,//go to your own mailbox to set it up! Under the account, if is 163 mailbox, below should become smtp.163.comSc. Host ="smtp.qq.com"; Sc.            Send (mm); }            Catch(Exception ex) {Throw NewException (ex.            Message); }        }

C #. NET Call QQ mailbox

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.