PhpPEARmail email sending instance

Source: Internet
Author: User
Phppearmail email sending instance -- & gt; & lt ;! Doctypehtmlpublic & quot;-w3cdtdxhtml10transitionalen & quot; http: wwww3orgtrxhtml1dtdxhtml1-transi

Phppear mail sending email instance

  1. -->
  2.  
  3.  
  4. Php sends emails 
  5.  
  6.  
  7.  
  8.  
  9.  
  10.  
  11.  
  12.  
  13. Require_once 'mail. php ';
  14. $ Conf ['mail'] = array (
  15. 'Host' => 'smtp .126.com ', // smtp server address
  16. 'Auth' => true, // true indicates that the smtp server needs to be verified, and false does not.
  17. 'Username' => 'liangbowen ', // User name
  18. 'Password' => '******' // password
  19. );
  20.  
  21. // Send an email
  22. $ Headers ['from'] = 'liangbowen @ 126.com '; // mail address
  23. $ Headers ['to'] = 'liangbowen @ hotmail.com '; // recipient address
  24. $ Headers ['subobject'] = 'Test mail send by php bowen.mvbb.com '; // mail title
  25. $ Mail_object = & mail: factory ('smtp ', $ conf ['mail']);
  26. // Body of the email
  27. $ Body = "this is an email sent to you. ";
  28. $ Mail_res = $ mail_object-> send ($ headers ['to'], $ headers, $ body); // send
  29. If (pear: iserror ($ mail_res) {// Check the error
  30. Die ($ mail_res-> getmessage ());
  31. }
  32. Else {
  33. Echo "send successful! ";
  34. }

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.