PHP uses Pear's own mail class library to send mail methods, Pear class Library _php Tutorial

Source: Internet
Author: User
Tags pear

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 ...

  • Related Article

    Contact Us

    The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

    If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

    A Free Trial That Lets You Build Big!

    Start building with 50+ products and up to 12 months usage for Elastic Compute Service

    • Sales Support

      1 on 1 presale consultation

    • After-Sales Support

      24/7 Technical Support 6 Free Tickets per Quarter Faster Response

    • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.