PHP uses SMTP to send mail Gmail met problem

Source: Internet
Author: User
  1. <? PHP
  2. Include("Class. phpmailer. php");// Imports phpmailer class to others
  3. $ Mail=NewPhpmailer ();// Create a new object
  4. $ Mail-> Issmtp ();// Set the SMTP mode for sending messages
  5. $ Mail-> Smtpauth = true;// You need a license to set SMTP.
  6. $ Mail-> Smtpsecure ="SSL";// The SMTP host of Gmail needs to use SSL authentication.
  7. $ Mail-> Host ="Smtp.gmail.com";// SMTP host of Gamil
  8. $ Mail-> Port = 465;// The SMTP port of the SMTP master machine of Gamil is port 465.
  9. $ Mail-> Charset ="Big5";// Set the firmware Specification
  10. $ Mail-> Username ="*********";// Set your certificate
  11. $ Mail-> Password ="*********";// Set the certificate secret
  12. $ Mail-> From = XXX@XXX.XXX.XXX;// Set the sender's mailbox
  13. $ Mail-> Fromname ="Guest guest";// Set the sender's name
  14. $ Mail-> Subject ="Phpmailer zookeeper letter";// Set the standards
  15. $ Mail-> Body = "Hello everyone,
  16. This is a Sort letter!
  17. ";// Set the content of the firmware.
  18. $ Mail-> Ishtml (true );// Set the firmware content to HTML
  19. $ Mail-> Addaddress (David@e-happy.com.tw","Tea rice");// Set the recipient's fax and name
  20. If(!$ Mail-> Send ()){
  21. Echo "Mailer error :".$ Mail-> Errorinfo;
  22. }Else{
  23. Echo "Message sent! ";
  24. }
  25. ?>

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.