PHP uses Pear's own mail class library to send mail methods, Pear class Library
This article explains how PHP sends mail using Pear's own mail class library. Share to everyone for your reference. Specific as follows:
This is the Mail class library with pear, you can use the Pear Install command to set up the corresponding library
BODY = "Dot I regenerate password"; SENDMAIL_SMTP ("xxxxxxxx@qq.com", ' Test ', $body); function sendmail_smtp ($smtpemailto, $mailsubject, $ Mailbody) {//error_reporting (7); require_once ' mail.php '; require_once ' mail/mime.php '; $from = ' admin@xxx.com '; $to = $s Mtpemailto; $password = ' xxxxxx '; $mail _config=array ("host" = "smtp.ym.163.com", "Port" =>25, "auth" =>true, "username" + = $from, "Passwor D "= $password," from "and" $from, "); $hdrs = Array (' from ' + $from, ' to ' + $to,//delivery address ' Subject ' = + $mailsubject); $mime = new Mail_mime (); $mime->settxtbody ($text); Add attachments//$mime->addhtmlimage (' php.gif ', ' image/gif ', ' 12345 ', true); $mime->_build_params[' html_charset '] = "utf-8";//Set encoding format $mime->_build_params[' head_charset '] = "utf-8";// Set the encoding format $mime->sethtmlbody ($mailbody); $body = $mime->get (); $hdrs = $mime->headers ($hdrs); $mail = mail::factory (' smtp ', $mail _config); $SUCC = $mail->send ($to, $hdrs, $body); if (Pear::iserror ($SUCC)) {//echo ' Email sending FaileD: '. $SUCC->getmessage (); $err = ' Email sending failed: '. $SUCC->getmessage (); $content = $to. " \\t ". Date (' y-m-d h:i:s ')." \\t ". $err." \\r\\n "; } else {//$content = $to. " \\t ". Date (' y-m-d h:i:s ')." \\t Email sent succesfully \\r\\n "; return true; }}
I hope this article is helpful to everyone's PHP programming.
http://www.bkjia.com/PHPjc/1028966.html www.bkjia.com true http://www.bkjia.com/PHPjc/1028966.html techarticle PHP uses Pear's own mail class library to send e-mail methods, Pear Class Library This article describes the PHP using the pear to send mail class library method. Share to everyone for your reference. Specific as follows ...