Home > Backend Development > PHP Tutorial > php uses Pear's NetMail to send smtp emails

php uses Pear's NetMail to send smtp emails

WBOY
Release: 2016-07-25 09:11:04
Original
1049 people have browsed it
  1. $params = array('host' => 'localhost',

  2. 'port' => '25',
  3. 'username' => 'test @jbxue.com',
  4. 'password' => 'test');

  5. //$to = $test_mail;

  6. $recipients = $to; Recipient, can be an array To store multiple addresses

  7. $headers['From'] = $email;

  8. $headers['To'] = $to;
  9. $headers['Subject'] = $subject;

  10. $body = $message;

  11. //Select the smtp sending method, of course, mail() and sendmail are also supported
  12. $mail_object = &Mail::factory('smtp', $params);
  13. if (PEAR::isError($e = $mail_object->send($recipients, $headers, $body))) {
  14. die($e->getMessage() . "n");
  15. }
  16. ?>

Copy code



source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template