How can I use PHPMailer to send emails ??, Phpmailer email
Source: http://www.ido321.com/1103.html
Sending emails is a common function. LZ also encountered this feature in the project today.
First, download PHPMailer.
1. https://github.com/dwqs/PHPMailer
2. http://download.csdn.net/detail/u011043843/8063583
After the download, decompress the file to the corresponding location of the project directory and set the class. phpmailer. php and class. smtp. introduce php to the project and check the Code: (do not delete the decompressed file; otherwise, it will not work)
<? Php // import require ("class. phpmailer. php "); require (" class. smtp. php "); date_default_timezone_set ('Asia/Shanghai'); // set the time zone GMT + $ mail = new PHPMailer (); // create a mail sending class $ address =" 15602277510@163.com "; $ mail-> IsSMTP (); // use SMTP to send $ mail-> CharSet = "UTF-8"; // set the encoding, otherwise, send Chinese garbled characters $ mail-> Host = "smtp.qq.com"; // your enterprise Post Office domain name $ mail-> SMTPAuth = true; // enable SMTP authentication $ mail-> Username = "461147874@qq.com"; // Post Office Username (complete email address, please) $ mai L-> Password = "**********"; // post office Password $ mail-> From = "461147874@qq.com "; // sender email address $ mail-> FromName = "dwqs"; $ mail-> AddAddress ($ address, "dwqs"); // recipient address, you can replace it with any email address in the format of AddAddress ("recipient email", "Recipient Name") // $ mail-> AddReplyTo ("",""); // $ mail-> AddAttachment ("/var/tmp/file.tar.gz"); // Add attachments // $ mail-> IsHTML (true ); // set email format to HTML // use HTML format $ mail-> Subject = "verify email"; // mail title $ mail-> Body = "H Ello, This is the test mail "; // the mail content $ mail-> AltBody =" This is the body in plain text for non-HTML mail clients "; // additional information, if (! $ Mail-> Send () {echo 'mailer Error: '. $ mail-> ErrorInfo;} else {echo "Message sent! Congratulations, the email is sent successfully! ";}?>
Test results:
Next article: How many regrets does your university have?
How do I configure phpmailer to send emails locally?
How to Use Phpmailer to receive emails-Technical Q &
Can you share it with me now? O (∩ _ ∩) O Thank you! 100,000 in a hurry !!!