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!