C # Send mail method

Source: Internet
Author: User
Tags mailmessage smtpclient

private void Toemail () {try {//Mail send class?                MailMessage mail = new MailMessage ();                Who sent the message? Mail.                from = new MailAddress ("[email protected]", "ZX");                Sent to who? Mail.                To.add ("[email protected]");                Title? Mail.                Subject = "Test";                Content encoding? Mail.                bodyencoding = Encoding.default;                Send priority? Mail.                priority = Mailpriority.high;                Message content? Mail.                Body = "Setet";                Is it sent in HTML form? Mail.                Isbodyhtml = true;                mail server and port?                SmtpClient smtp = new SmtpClient ("smtp.qq.com", 25); Smtp.                useDefaultCredentials = false;                Specifies whether to smtpclient a connection using Secure Sockets Layer (SSL) encryption. Smtp.                Enablessl = true;                Specify how to send? Smtp.                Deliverymethod = Smtpdeliverymethod.network; Specify LoginRecord name and password? Smtp.                Credentials = new System.Net.NetworkCredential ("2475523429", "IMJRWMHJHEEKDHHD");                Time out? Smtp.                Timeout = 10000; Smtp.            Send (mail);            } catch (Exception exp) {MessageBox.Show ("Send mail Exception"); }        }

  

C # Send mail method

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.