How to use Phpmailer to achieve mail delivery?? , Phpmailer Mail
Source: http://www.ido321.com/1103.html
Send mail is a common function, LZ today in the project also met, hereby share.
First, go to download Phpmailer
1, Https://github.com/dwqs/PHPMailer
2, http://download.csdn.net/detail/u011043843/8063583
After downloading, unzip the file to the corresponding location of the project directory, introduce class.phpmailer.php and class.smtp.php into the project, see the code: (Unzip the file do not delete, otherwise not)
//Necessary import
require("class.phpmailer.php");require("class.smtp.php"); Date_default_timezone_set (' Asia/shanghai ');//Set time zone East area eight$mail =NewPhpmailer ();//Set up a mail sending class$address ="15602277510@163.com"; $mail->issmtp ();//Send using SMTP$mail->charset ="UTF-8";//Set encoding, otherwise send Chinese garbled$mail->host ="Smtp.qq.com";//Your enterprise Post office domain name$mail->smtpauth =true;//Enable SMTP Authentication feature$mail->username ="461147874@qq.com";//Post Office User name (please fill in the full email address)$mail->password ="**********";//Post office password$mail->from ="461147874@qq.com";//Email sender email Address$mail->fromname ="Dwqs"; $mail->addaddress ($address,"Dwqs");//Recipient address, can be replaced with any email message you want to receive, the format is addaddress ("Recipient Email", "Recipient name")//$mail->addreplyto ("", "");//$mail->addattachment ("/var/tmp/file.tar.gz");//Add Attachments//$mail->ishtml (TRUE);//Set email format to HTML//whether HTML is used$mail->subject ="Verify Mail";//Mail header$mail->body ="Hello, this is Test mail";//email content$mail->altbody ="This was the body in plain text for non-html mail clients";//Additional information can be omittedif(! $mail->send ()) {Echo ' Mailer Error: '. $mail->errorinfo; }Else{Echo "Message sent! Congratulations, Mail sent successfully!" "; }?>
Test results:
Next: Your university, how many regrets?
What do I need to configure to send mail locally using Phpmailer?
PHP using Phpmailer to send mail is unsuccessful
Server does not have SMTP
http://www.bkjia.com/PHPjc/899960.html www.bkjia.com true http://www.bkjia.com/PHPjc/899960.html techarticle How to use Phpmailer to achieve mail delivery?? , Phpmailer Mail Source: http://www.ido321.com/1103.html send mail is a common function, LZ today in the project also met, hereby ...