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 not send mail problems
Support Text/html format mail
Can embed image images
Support for mail clients that do not support HTML reading
Powerful Send-mail debugging features debug
Customizing message headers
Redundant SMTP server support
Supports 8bit, base64, binary, and quoted-printable encodings
Text Wrap
Support multiple attachment send function
Supports the SMTP server Authentication feature
Platform test success in SendMail, QMail, Postfix, Gmail, Imail, Exchange, etc.
Included in the download file, including detailed documentation and sample instructions, so don't worry about the difficult problem!
Phpmailer is very small, simple, convenient, fast
The use of Phpmailer (here for example using Gmail SMTP to send mail, of course, also support sendmail pop and other means):
First download the latest version of the package to http://phpmailer.worxware.com/
When the download is complete, find class.phpmailer.php, class.smtp.php two classes and put them in your own directory!
Then create a new PHP file here named: phpmail.php
phpmail.php contents are as follows:
I directly send the email module as a function postmail (), we use the time directly call the function can be, the function content is:
Program code
Copy Code code as follows:
function Postmail ($to, $subject = "", $body = "") {
$to represents the recipient address $subject represents the message header $body 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 Phpmailer (); New a Phpmailer object out
$body = eregi_replace ("[\]", ", $body); Filter the content of the message as necessary
$mail->charset = "UTF-8";//Set message encoding, default iso-8859-1, if you have to set this item in Chinese, otherwise garbled
$mail->issmtp (); Set up to use the SMTP service
$mail->smtpdebug = 1; To enable the SMTP debugging feature
1 = errors and messages
2 = messages Only
$mail->smtpauth = true; To 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 address, such as admin@domain.com ', ' sender name ');
$mail->addreplyto ("Mail reply address, such as admin@domain.com", "Mail reply person's name");
$mail->subject = $subject;
$mail->altbody = "To view", compatible email viewer! with an HTML; 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 success!" ";
}
}