C # calls QQ mailbox SMTP send mail modified version code

Source: Internet
Author: User
Tags mailmessage smtpclient
 try {mailmessage mm = new MailMessage ();                MailAddress Fromma = new MailAddress ("xxxx@qq.com");                MailAddress Toma = new MailAddress ("MMMMMMM@qq.com", null); Mm.                from = Fromma; Recipient mm.                To.add ("MMMMMM@qq.com"); Mailbox title mm.                Subject = "Hello Dear:"; Mm.                Isbodyhtml = true; Message content mm. Body = "Hello Mr Meteor!"                "; Encoding format for content mm.                bodyencoding = System.Text.Encoding.UTF8; Mm.                ReplyTo = Toma; Mm.                Sender =fromma; Mm.                Isbodyhtml = false; Mm.                Deliverynotificationoptions = deliverynotificationoptions.onsuccess; Mm. Cc.                ADD (Toma);                SmtpClient sc = new SmtpClient ();                NetworkCredential NC = new NetworkCredential (); nc. UserName = "XXXXX@qq.com";//your e-mail address NC. Password = "zzzzz";//Your email password, here's the secretCode is xxxxx@qq.com mailbox password, special instructions under ~ SC.                useDefaultCredentials = true; Sc.                Deliverymethod = Smtpdeliverymethod.network; Sc.                Credentials = NC; If this is reported to mail from the address must be same as authorization user this error, is your QQ mailbox does not open SMTP,//to your own mailbox settings can be! Under the account, if is 163 mailbox, below should become smtp.163.com SC.                Host = "smtp.qq.com"; Sc.            Send (mm); } catch (Exception ex) {throw new Exception (ex).            Message); }

This is I use my 2 QQ test success, there are problems I hope you correct ~ ~

More C # calls QQ mailbox SMTP send mail modified version code related articles please follow topic.alibabacloud.com!

"Recommended"

1. Detailed description Python uses SMTP to send mail instances

2. Python code summary for sending mail using SMTP

3. Share Python to implement SMTP send message graphics instances

4. Python sends mail using SMTP

5. PHP smtp Send mail

6. Python SMTP Mail module detailed

7. Python smtplib module sends SSL/TLS secure message instances

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