Use PHPMailer to send emails

Source: Internet
Author: User

Use PHPMailer to send emails

PHPMailer Official Website: http://phpmailer.worxware.com/

PHPMailer GitHub: https://github.com/Synchro/PHPMailer

For more information, see the code list:

 IsSMTP (); // set the use of SMTP $ mail-> Host = 'mail .wanzhao.com '; // mail server address $ mail-> SMTPAuth = true; // enable SMTP authentication $ mail-> CharSet = "UTF-8"; // set the email encoding $ mail-> setLanguage ('zh _ cn '); // set the Chinese prompt for error $ mail-> Username = 'wanzhao @ wanzhao.com '; // SMTP Username, that is, the personal email address $ mail-> Password = 'www123456 '; // SMTP password, that is, your mailbox password $ mail-> SMTPSecure = 'tls '; // You must enable encryption. Note: You must enable the php_openssl module $ mail-> Priority = 3; // set mail Priority 1: High, 3: normal (default), 5: low $ mail-> From = 'liruxing @ wanzhao.com '; // sender's email address $ mail-> FromName = 'liluxing '; // sender's name $ mail-> addAddress ('liruxing1715 @ 163.com', 'Lee '); // Add the recipient $ mail-> addAddress ('Ellen @ example.com '); // Add multiple recipients $ mail-> addReplyTo ('info @ example.com', 'info '); // Add a reviewer $ mail-> addCC ('liruxing1715 @ sina.com '); // Add a CC to $ mail-> addCC ('2017 @ qq.com '); // Add multiple CC recipients $ mail-> ConfirmReadingTo = 'ruxing @ wanzhao.com '; // Add the send receipt email address, that is, when the recipient opens the email, will ask if a receipt is returned $ mail-> addBCC ('1970 @ qq.com '); // Add a BCC, the Mail Header will not display the BCC information $ mail-> WordWrap = 50; // set to automatically wrap 50 characters $ mail-> addAttachment ('. /1.jpg '); // Add an attachment $ mail-> addAttachment ('/tmp/image.jpg ', 'one pic '); // Add multiple attachments $ mail-> isHTML (true); // set the email format to HTML $ mail-> Subject = 'here is the theme '; $ mail-> Body = 'this is the HTML information bodyIn bold!. Time :'. date ('Y-m-d H: I: s'); $ mail-> AltBody = 'this is the subject in plain text for non-HTML mail clients '; if (! $ Mail-> send () {echo 'message cocould not be sent. '; echo 'mailer Error :'. $ mail-> ErrorInfo; exit;} echo 'message has been sent ';


Note: Please indicate the source for reprinting!

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.