php Send mail (phpmailer details and instructions for how to use) _php tutorial

Source: Internet
Author: User
Tags php send mail word wrap
Phpmailer is also a powerful mail-enabled class

Main features of Phpmailer:

Digital signatures that support message S/MIME encryption
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 the problem
Supports text/html format messages
Image images can be embedded
Support for HTML reading is not supported for mail clients
Powerful debug function for sending mail
Custom Mail Header
Redundant SMTP server support
Supports 8bit, base64, binary, and quoted-printable codes
Word Wrap
Support multi-attachment sending function
Support for SMTP server Authentication feature
Tested successfully on SendMail, QMail, Postfix, Gmail, Imail, and Exchange platforms
The download file provided includes a detailed description of the documentation and sample instructions, so don't worry about the difficulty of getting started!
Phpmailer is very small, simple, convenient and fast

The above information from Jiucool translation from the Phpmailer official website, reproduced please specify!

The use of Phpmailer (here to use Gmail SMTP to send mail as an example, but also support SendMail pop and other ways):

1. First download the latest version of the package to http://phpmailer.worxware.com/
2. After the download is complete, locate the class.phpmailer.php, class.smtp.php two classes and put them in your own directory!
3. Then create a new PHP file named here: phpmail_jiucool.php

phpmail_jiucool.php content is as follows:

I directly write the e-mail module as a function postmail_jiucool_com (), you can call the function directly when you use it, the function is: Functions postmail_jiucool_com ($to, $subject = "", $ BODY = "") {
Author:jiucool website:http://www.jiucool.com
$to represents the recipient address $subject represents 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 zone
Require_once (' class.phpmailer.php ');
Include ("class.smtp.php");
$mail = new Phpmailer (); New a Phpmailer object.
$body = eregi_replace ("[\]" ",", $body); Filtering the content of the message as necessary
$mail->charset = "UTF-8";//Set the message encoding, default iso-8859-1, if the Chinese language must be set, otherwise garbled
$mail->issmtp (); Setting up using the SMTP service
$mail->smtpdebug = 1; Enabling the SMTP debugging feature
1 = errors and messages
2 = messages Only
$mail->smtpauth = true; Enable the SMTP authentication feature
$mail->smtpsecure = "SSL"; Security protocols
$mail->host = "smtp.googlemail.com"; SMTP Server
$mail->port = 465; Port number of the SMTP server
$mail->username = "SMTP Server user name"; SMTP Server user name
$mail->password = "SMTP server password"; SMTP server password
$mail->setfrom (' sender's address, such as admin#jiucool.com #换成 @ ', ' sender name ');
$mail->addreplyto ("Mail reply address, such as admin#jiucool.com #换成 @", "Mail reply person's name");
$mail->subject = $subject;
$mail->altbody = "To view the message, please use an HTML compatible email viewer! -From www.jiucool.com "; Optional, comment out and test
$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! ";
}
}
Of course, there are more and more detailed configuration, we can play freely!

from:http://www.jiucool.com/phpmailer-php-email/

http://www.bkjia.com/PHPjc/478029.html www.bkjia.com true http://www.bkjia.com/PHPjc/478029.html techarticle Phpmailer is also a powerful message class Phpmailer main features: Support mail S/MIME encrypted digital signature support mail multiple TOs, CCs, BCCs and Reply-tos can work ...

  • 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.