Phpmailer is a very useful class to send mail in PHP, it encapsulates a lot of important functions and functions, let us send mail, and adjust the contents of the message becomes very easy, the following gives a Phpmailer test case, easy to use later query.
First, you need to download the Phpmailer class library, which can now be extracted from GitHub.
: Https://github.com/PHPMailer/PHPMailer
The following program: The use of QQ mailbox to test, need to go to the mailbox inside
Set = "account ="Pop3/imap/smtp/exchange/carddav/caldav service
Tick the pop3/smtp service.
<?php include "class.phpmailer.php"; $mail = new Phpmailer (); $mail->issmtp (); $mail->smtpdebug = 2; $mail->host = "smtp.qq.com"; $mail->port = "465"; $mail->smtpsecure = "SSL"; $mail->smtpauth = true; $mail->username = "470356072";//username $mail->password = "******";//repalce your Password $mail- >addreplyto ("[Email protected]", "network"); $mail->addaddress (' [email protected] '); $mail->setfrom ("[Email protected]", "network"); $mail->ishtml (false); $mail->subject = "Test mail"; $mail->msghtml ("This is a test mail! "); $mail->send (); if ($mail->send ()) { echo "success"; } else { echo "false"; }? >
PHP Application Phpmailer Use