PHPMailer: FeaturedemailtransferclassforPHP_PHP tutorial

Source: Internet
Author: User
Tags word wrap one mail
PHPMailer: FeaturedemailtransferclassforPHP. Php (as the mainstream development language) Mailer: Featuredemailtransferclassforphp (as the mainstream development language) php (as the mainstream development language) mailer is a very php (as the mainstream development language) Mailer: Featured email transfer class for php (as the mainstream development language)
Php (as the mainstream development language) Mailer is a very useful php (as the mainstream development language) Mail class. It supports sending mails using the smtp server, and supports mail servers such as Sendmail, qmail, Postfix, Imail, Exchange, Mercury, and Courier. The SMTP server also supports authentication and multiple SMTP sending (but it is not clear what is the use ). email sending can include multiple TO, CC, BCC and REPLY-TO, supports text and HTML mail formats, can automatically wrap, supports attachments and images in various formats, customize the basic mail functions of the mail class.

Since php (as the mainstream development language) only contains one mail function, php (as the mainstream development language) Mailer is greatly enhanced, I believe it can meet the needs of many people. It mainly includes two types of files: class used to send mail. php (as the mainstream development language) mailer. php (as the mainstream development language) and smtp implementation class. smtp. php (as the mainstream development language ). There are also files that can implement multiple error outputs, as well as detailed documents. Software release follows the LGPL protocol.

It's easy to use. you can see the following example:

Require ("class. php (as the mainstream development language) mailer. php (as the mainstream development language )");

$ Mail = new php (as the mainstream development language) Mailer ();

$ 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-> 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-> Subject = "Here is the subject ";
$ Mail-> Body = "This isHTML 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 has been sent ";


For details, see the home page of Mailer in php (as the mainstream development language): http: // php (as the mainstream development language) mailer.sourceforge.net/

Http://www.bkjia.com/PHPjc/508719.htmlwww.bkjia.comtruehttp://www.bkjia.com/PHPjc/508719.htmlTechArticlephp (as the mainstream development language) Mailer: Featured email transfer class for php (as the mainstream development language) mailer is a very...

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.