Phpmailer's official website: http://phpmailer.worxware.com/
Phpmailer Latest Class Library: "Click to download"
Phpmailer Github:https://github.com/synchro/phpmailer, this page also provides examples of use, but not very comprehensive.
To use the method, see the code listing:
[PHP]View PlainCopy
- <?php
- Header (' content-type:text/html; Charset=utf-8 ');
- Require './phpmailerautoload.php ';
- $mail = new Phpmailer;
- $mail->issmtp (); //Set up mail using SMTP
- $mail->host = ' mail.wanzhao.com '; //mail server address
- $mail->smtpauth = true; //Enable SMTP authentication
- $mail->charset = "UTF-8"; //Set message encoding
- $mail->setlanguage (' zh_cn '); //Set error Chinese tips
- $mail->username = ' [email protected] '; //SMTP user name, which is the personal email address
- $mail->password = ' www123456 '; //SMTP password, which is the personal mailbox password
- $mail->smtpsecure = ' TLS '; //settings enable encryption, note: The Php_openssl module must be turned on
- $mail->priority = 3; //Set Message Priority 1: High, 3: normal (Default), 5: Low
- $mail->from = ' [email protected] '; //Sender email address
- $mail->fromname = ' ru li star '; //Sender name
- $mail->addaddress (' [email protected] ', ' Lee '); //Add recipient
- $mail->addaddress (' [email protected] '); //Add multiple recipients
- $mail->addreplyto (' [email protected] ', ' information '); //Add a reply to a person
- $mail->ADDCC (' [email protected] '); //Add cc person
- $mail->ADDCC (' [email protected] '); //Add multiple cc people
- $mail->confirmreadingto = ' [email protected] '; //Add send receipt e-mail address, that is, when the recipient opens the message, asks if receipts have occurred
- $mail->addbcc (' [email protected] '); //Add dongle, Mail header will not display the secret send the person information
- $mail->wordwrap = 50; //Set line wrap 50 characters
- $mail->addattachment ('./1.jpg '); //Add attachments
- $mail->addattachment ('/tmp/image.jpg ', ' one pic '); //Add multiple attachments
- $mail->ishtml (TRUE); //Set message format to HTML
- $mail->subject = ' Here is the theme ';
- $mail->body = ' This is the HTML information Body <b>in bold!</b>. Time: '. date (' y-m-d h:i:s ');
- $mail->altbody = ' This is the principal in plain text for non-html mail clients ';
- if (! $mail->send ()) {
- echo ' Message could not being sent. ';
- echo ' Mailer Error: '. $mail->errorinfo;
- exit;
- }
- Echo ' Message has been sent ';
Send mail using Phpmailer