Use PHPMailer to send emails, and phpmailer to send emails. Use PHPMailer to send emails, and phpmailer to send emails to blog. csdn. netliruxing1715articledetails7914974PHPMailer's official website: phpmailer. worxware. comPHP use PHPMailer to send emails, and phpmailer to send emails
Reproduced http://blog.csdn.net/liruxing1715/article/details/7914974
PHPMailer official website: http://phpmailer.worxware.com/
PHPMailer latest class library: [click to download]
PHPMailer GitHub: https://github.com/synchro/phpmailer. this page also contains the use case.
For more information, see the code list:
Header ('content-Type: text/html; Charset = utf-8 ');
Require './PHPMailerAutoload. php ';
$ Mail = new PHPMailer;
$ Mail-> isSMTP (); // you can specify SMTP for an email.
$ Mail-> Host = 'mail .wanzhao.com '; // email server address
$ Mail-> SMTPAuth = true; // enable SMTP Authentication
$ Mail-> CharSet = "UTF-8"; // Set the email encoding
$ Mail-> setLanguage ('zh _ cn'); // sets the Chinese prompt for an error.
$ Mail-> Username = 'wanzhao @ wanzhao.com '; // SMTP Username, that is, the personal email address
$ Mail-> Password = 'www123456'; // SMTP Password, that is, the personal email Password
$ Mail-> SMTPSecure = 'tls '; // Set to enable encryption. note: The php_openssl module must be enabled.
$ Mail-> Priority = 3; // Set the mail Priority to 1: high, 3: Normal (default), 5: low
$ Mail-> From = 'liruxing @ wanzhao.com '; // The sender's email address.
$ Mail-> FromName = 'lilu Xing'; // sender name
$ Mail-> addAddress ('liruxing1715 @ 163.com ', 'Lil'); // add recipient
$ Mail-> addAddress ('Ellen @ example.com '); // add multiple recipients
$ Mail-> addReplyTo ('info @ example.com ', 'information'); // add a reply recipient
$ Mail-> addCC ('liruxing1715 @ sina.com '); // add Cc recipients
$ Mail-> addCC ('1970 @ qq.com '); // add multiple cc recipients
$ Mail-> ConfirmReadingTo = 'liruxing @ wanzhao.com '; // add the Send receipt email address, that is, when the recipient opens the email, it will ask whether a receipt has occurred
$ Mail-> addBCC ('1970 @ qq.com '); // add a bcc. the Mail Header does 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); // you can specify the email format as HTML.
$ Mail-> Subject = 'here is the topic ';
$ 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 ';
Unzip PHPMailer to send mail, phpmailer to send mail reprint http://blog.csdn.net/liruxing1715/article/details/7914974 PHPMailer official website: http://phpmailer.worxware.com/PHP...