This article is mainly on the main features of Phpmailer and simple use of the instructions are introduced, the need for friends can come to the reference, I hope to help you.
Support Message S/MIME encrypted digital signature support mail multiple TOs, CCs, BCCs and reply-tos can work on any server platform, so don't worry about the win platform can't send mail questions support text/ HTML-formatted messages can embed image images support for mail clients that do not support HTML reading powerful send-mail debugging features debug custom mail header redundant SMTP server support Support 8bit, base64, binary, and quoted-printable code text line support for multiple attachment Send function Support SMTP server authentication function in SendMail, QMail, Postfix, Gmail, Imail, Exchange and other platform test success download files, including detailed documentation and sample instructions, so don't worry about the difficult problem! Phpmailer is very small, simple, convenient, fast Phpmailer use (here to use Gmail smtp send mail as an example, of course, support sendmail pop, etc.): first to HTTP ://phpmailer.worxware.com/Download the latest version of the package download completed, find class.phpmailer.php, class.smtp.php two classes into their own directory! Then create a new PHP file here named:phpmail.php phpmail.php content as follows: I directly send the email module as a function postmail (), we use the time to call the function directly, The function content is: program code code as follows: function Postmail ($to, $subject = "", $body = "") { //$to represents the recipient address $subjec T indicates that the message header $body represents the message body //error_reporting (E_all); error_reporting (e_strict);   Date_default_timezone_set ("Asia/shanghai")/Set time zone East eight area require_once (' class.phpmailer.php '); include ("class.smtp.php"); $mail = new Phpmail ER (); New a Phpmailer object out $body = Eregi_replace ("[]", ", $body); Make the necessary filter $mail->charset = "UTF-8";/Set message encoding, default iso-8859-1, if the Chinese must be set up, otherwise garbled $mail- >ISSMTP (); Set up to use SMTP service $mail->smtpdebug = 1; //Enable SMTP debugging features &NB Sp //1 = Erro RS and messages & nbsp //2 = messages only $mail-&Gt Smtpauth = true; //Enable SMTP authentication function $mail->smtpsecure = "SSL"; //security protocol $mail->host = "SMTP. Googlemail.com "; //SMTP server $mail->port = 465; //SMTP server port number $mail->username = "S MTP Server user name "; //SMTP Server user name $mail->password = "SMTP server password"; //SMTP server password $mail->setfrom (' sender address, such as admin@domain.com ', ' Sender name ' ); $mail->addreplyto ("Mail reply address, such as admin@domain.com", "Name of mail reply person"); $mail->subject = $subject; $mail->altbody = "To view", please use an HTML compatible email viewer! "; Optional, comment out and test &NBsp $mail->msghtml ($body); $address = $to; $mail->addaddress ($address, "Recipient name"); //$mail->addattachment ("Images/phpmailer.gif"); //attachment //$mail->addattachment ("Images/phpmailer_mini.gif"); Attachment if (! $mail->send ()) { echo "Mailer Error:". $mail->errorinfo; } else { echo "message sent! Congratulations, Mail sent successfully! "; } }