How to handle smtp mail errors

Source: Internet
Author: User
What if smtp always fails to send emails? I want to use smtp to send an email to activate the account & nbsp; but I can't solve this problem all the time. ------ solution ------------------ did you successfully send the email during your test? This looks quite normal. isn't the debugging log closed? Check if there is any log or the like. the sending mailbox I use is such a debugging echo & nbsp; cause:. $ this-& smtp always fails to send emails. what should I do?
I want to use smtp to send an email to activate the account. this problem persists.
------ Solution --------------------
Did you send the message successfully during your test?

This looks quite normal.

This is just not turning off the debugging log, right?

Check whether or not a log is generated.

I used the sending mailbox for such debugging.
Echo "cause:". $ this-> smtp-> logs;

You should have something similar.
------ Solution --------------------
Reference:
Reference: Did you send the message successfully during your test?

This looks quite normal.

This is just not turning off the debugging log, right?

Check whether or not a log is generated.

I used the sending mailbox for such debugging.
Echo "cause:". $ this-> smtp-> logs;

You should have something similar.
If the test fails, can you make it clear? I still don't know much about it.


This page is just debugging information. I didn't see any errors. Ask the experts.
The following is what I got from other places. my test is successful. it feels good to use it. you can try it.
 $ Ip = $ _ SERVER ['remote _ ADDR '];
// Send an OK email.
Include "smtp. class. php"; // The Mail class to be included
// $ Smtpserver = "SMTP.163.com"; // address of your smtp server
$ Smtpserver = ""; // smtp server address
$ Port = 25; // The smtp server port, usually 25
// $ Smtpuser = ""; // user name of the smtp server you log on
// $ Smtppwd = ""; // password of your smtp server
$ Mailtype = "HTML"; // mail type. optional values: TXT or HTML. TXT indicates a plain text email. HTML indicates an html email.
$ Sender = "{$ email}"; // sender's email
// Sender, which is generally the same as the username ($ smtpuser) for logging on to the smtp server. otherwise, sending may fail due to the setting of the smtp server.
$ Smtp = new smtp ($ smtpserver, $ port, false, $ smtpuser, $ smtppwd, $ sender); // if the third value is false, you can log on anonymously to send emails, comment out $ smtpuser and $ smtppwd
// $ Smtp-> debug = true; // whether to enable debugging. it is only used for testing the program. Note this line without comments during official use.
$ To = ""; // recipient's email
// Prepared email address
$ Subject = "$ time-($ address)-$ zixun1"; // enter the subject of the email here.
$ Body = "" // The body of the email written here
$ Send = $ smtp-> sendmail ($ to, $ sender, $ subject, $ body, $ mailtype); // send an email
?>

// If an error occurs, debug the method. This section contains an else or something that can be used to send unsuccessful code.
Echo "cause:". $ this-> smtp-> logs; // logs sent by smtp are generated.
?>

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.