PHPMailer is a PHP useful to send the message class. It supports the use smtp server to send mail, also supports Sendmail, qmail, Postfix, Imail, Exchange, Mercury, Courier and other mail servers. If the server also supports SMTP authentication, multiple SMTP to send (but not quite sure what's the use.) Mail may include multiple TO, CC, BCC and REPLY-TO, supports both text and HTML mail format, you can wrap in support of attachments and images in various formats, custom e-mail first class basic mail functions. Because only contains a PHP mail function, so PHPMailer is greatly enhanced its is believed that meet the needs of many people, huh, huh.Which mainly include two types of documents: send mail function used to implement the class.phpmailer.php and smtp implementation class.smtp.php. Then there can achieve a variety of error output file, and a very detailed document. Software released under the LGPL agreement.
Is also very simple to use, see the following example to understand:
require ("class.phpmailer.php");
$ Mail = new PHPMailer ();
$ Mail-> IsSMTP (); / / send via SMTP
$ Mail-> Host = "smtp1.site.com; smtp2.site.com"; / / SMTP servers
$ Mail-> SMTPAuth = true; / / turn on SMTP authentication
$ Mail-> Username = "jswan"; / / SMTP username
$ Mail-> PassWord = "secret"; / / SMTP password
'Www.knowsky.com
$ Mail-> From = "from@email.com";
$ Mail-> FromName = "Mailer";
$ Mail-> AddAddress ("josh@site.com", "Josh Adams");
$ Mail-> AddAddress ("ellen@site.com"); / / optional name
$ Mail-> AddReplyTo ("info@site.com", "Information");
$ Mail-> Host = "smtp1.site.com; smtp2.site.com"; / / SMTP servers
$ Mail-> SMTPAuth = true; / / turn on SMTP authentication
$ Mail-> Username = "jswan"; / / SMTP username
$ Mail-> PassWord = "secret"; / / SMTP password
'Www.knowsky.com
$ Mail-> From = "from@email.com";
$ Mail-> FromName = "Mailer";
$ Mail-> AddAddress ("josh@site.com", "Josh Adams");
$ Mail-> AddAddress ("ellen@site.com"); / / optional name
$ Mail-> AddReplyTo ("info@site.com", "Information");
$ Mail-> WordWrap = 50; / / set word wrap
$ Mail-> AddAttachment ("/ var / tmp / file.tar.gz"); / / attachment
$ Mail-> AddAttachment ("/ tmp / image.jpg", "new.jpg");
$ Mail-> IsHTML (true); / / send as HTML
$ Mail-> AddAttachment ("/ var / tmp / file.tar.gz"); / / attachment
$ Mail-> AddAttachment ("/ tmp / image.jpg", "new.jpg");
$ Mail-> IsHTML (true); / / send as HTML
$ Mail-> Subject = "Here is the subject";
$ Mail-> Body = "This is the HTML body ";
$ Mail-> AltBody = "This is the text-only body";
$ Mail-> Body = "This is the HTML body ";
$ Mail-> AltBody = "This is the text-only body";
if (! $ mail-> Send ())
{
echo "Message was not sent ";
echo "Mailer Error:". $ mail-> ErrorInfo;
exit;
}
{
echo "Message was not sent ";
echo "Mailer Error:". $ mail-> ErrorInfo;
exit;
}
echo "Message has been sent";