My top Phpmailer, like its name, is a mail-sending class written using PHP, and Phpmailer is a powerful class.
Official website: http://phpmailer.codeworxtech.com/
download:http://code.google.com/a/apache-extras.org/p/phpmailer/
The main features of Phpmailer are:
1, in the message contains multiple to, CC, BCC and reply-to.
2, a wide range of platform applications, supported SMTP servers include Sendmail, qmail, Postfix, Gmail, Imail, Exchange, and so on.
3, support embedded images, attachments, HTML mail.
4, Reliable and powerful debugging function.
5, Support SMTP authentication.
6, custom mail header.
7, Support 8bit, base64, binary and quoted-printable coding.
The latest stable version of Phpmailer is 2.2.1, which can be downloaded from the official website.
New version of support tcp,ssl,tls,ssl2.0, after testing the perfect support 163,qq,gmail,foxmail and so on,
To configure PHP locally, you must open the socket and OPEN_SSL modules.
Attachment provides a letter of the code, please run a stand-alone, do not send too many, or may be the SMTP server IP.
Instance 1
To send a message using SMTP:
The code is as follows |
Copy Code |
$mail = new Phpmailer (); Get a Phpmailer instance $mail->charset = "gb2312"; Set up using gb2312 Chinese code $mail->issmtp (); To set the SMTP way to send mail $mail->host = "192.168.1.27"; Set the address of the mail server $mail->port = 25; Set the port for the mail server by default of 25 $mail->from = "mailFrom@tencent.com"; Set the sender's mailbox address $mail->fromname = "Samzhang"; Set the sender's name $mail->smtpauth = true; To set whether SMTP requires password authentication, true indicates the need for $mail->username= "Samzhang"; $mail->password = ' Your Password '; $mail->subject = $subject; Set the title of a message $mail->altbody = "text/html"; Optional, comment out and test $mail->body = "Content of your mail"; $mail->ishtml (TRUE); Set whether content is HTML type $mail->wordwrap = 50; Set the number of characters per line $mail->addreplyto ("samzhang@tencent.com", "Samzhang"); Set the address of the recipient of the reply $mail->addaddress ("mailTo@tencent.com", "ToName"); Set the address of your inbox if (! $mail->send ()) {//Send mail echo send failed: '; } else { echo "sent successfully; |
Note:
Phpmailer is a very good mail-sending plug-in, can be used for any mail delivery function, but if you use a free mailbox such as 163,qq,sina such free mailbox if mass group may be sealed number OH. I will not say much about the others.