Php uses smtp class to implement email sending, phpsmtp class email _ PHP Tutorial

Source: Internet
Author: User
Php uses the smtp class for email sending and phpsmtp emails. Php uses the smtp class for email sending. the method for sending phpsmtp-type email smtp is simple and stable, and only a few lines of simple configuration can be sent, are you looking forward to trying php to use the smtp class for email sending and phpsmtp emails?

The smtp method for sending mails is simple and stable, and only a few lines of simple configuration can be sent. are you looking forward to a try!

The following is the core code:

<? Php require_once "email. class. php "; // ********************* configuration information **************** * *************** $ smtpserver = "smtp.126.com "; // SMTP server $ smtpserverport = 25; // SMTP server port $ smtpusermail = "new2008oh@126.com"; // SMTP server's user email $ smtpemailto = $ _ POST ['topin']; // send to $ smtpuser = "new2008oh"; // SMTP server user account $ smtppass = "your email password "; // SMTP server user password $ mailtitle =$ _ POST ['title']; // email subject $ mailcontent = "". $ _ POST ['content']. ""; // mail content $ mailtype = "HTML"; // mail format (HTML/TXT ), TXT is a text email ******** * ******************* $ smtp = new smtp ($ smtpserver, $ smtpserverport, true, $ smtpuser, $ smtppass); // Here, true indicates that authentication is used; otherwise, authentication is not used. $ smtp-> debug = false; // whether to display the sent debugging information $ state = $ smtp-> sendmail ($ smtpemailto, $ smtpusermail, $ mailtitle, $ mailcontent, $ mailtype); echo"

"; If ($ state =" ") {echo" Sorry, email sending failed! Check whether the email address is entered incorrectly. "; Echo" Click here to return "; exit ();} echo" Congratulations! Email sent !! "; Echo" Click here to return "; echo"

";?>

Effect appreciation:

The method shared in this article is simple and easy to understand.

The following is the source code provided for you: php uses the smtp class to send emails.

The smtp method for sending mails is both simple and stable, and only a few lines of simple configuration can be sent. are you looking forward to a try...

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.