PHP uses SMTP class to send e-mail, PHPSMTP class e-mail _php tutorial

Source: Internet
Author: User

PHP uses SMTP class to send e-mail, PHPSMTP class e-mail


SMTP class Send mail method is simple and stable, a few lines of simple configuration can send e-mail, is not very looking forward to try it!

Here's 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"; user mailbox for//smtp server $smtpemailto = $_post[' toemail '];//sent to who $smtpuser = " New2008oh ";//smtp Server user account $smtppass =" Your mailbox password ",//SMTP server user Password $mailtitle = $_post[' title '];//message subject $mailcontent ="

". $_post[' content ']."

";//message content $mailtype =" HTML ";//Message Format (html/txt), TXT for text mail//************************ configuration information **************************** $ SMTP = new SMTP ($smtpserver, $smtpserverport, True, $smtpuser, $smtppass);//A true in this indicates that authentication is used, otherwise no authentication is used. $SMTP->debug = false;//whether to display debug information sent $state = $smtp->sendmail ($smtpemailto, $smtpusermail, $mailtitle, $ Mailcontent, $mailtype); echo ""; if ($state = = "") {echo] Sorry, the message failed to send! Please check that your email address is incorrect. "; echo "Point this return"; Exit (); } echo "Congratulations! Mail sent successfully!! "; echo "Point this return"; echo "";? >

Effect Appreciation:

This article shares the method to be easy to understand, hoped can help everybody.

Here is the source code for everyone to download the address: PHP using the SMTP class for e-mail delivery

http://www.bkjia.com/PHPjc/1066504.html www.bkjia.com true http://www.bkjia.com/PHPjc/1066504.html techarticle PHP using the SMTP class to implement e-mail delivery, PHPSMTP Class E-Mail SMTP class method of sending mail is simple and stable, a few lines of simple configuration can send e-mail, is not very looking forward to 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.