In the discuz x2.5 mailbox settings, I have already mentioned a lot of Solutions to mail settings and common problems. Today I will mainly describe discuz! Troubleshooting of failed email sending is applicable to the discuz program in any section.
Discuz! Troubleshooting for failed email sending:
1. Check whether the entered email information is correct.
2. view the mail log file. There is a file like 201210_smtp.php under the Data/log directory. The following is an example.
Example 1:
- <? PHP exit;?> 2012-10-17 16:59:59 127.0.0.1 1/admin. php? Action = checktools & Operation = mailcheck & frame = No (smtp.qq.com: 25) mail from-
Copy code
Use the failure log to enter the program source/function/function_mail.php. the Sendmail function will record the failure. In the above log, the code in the sendmail function is "mail from. In this way, locate the specific error.
- Fputs ($ FP, "mail from: <". preg_replace ("/. * \ <(. + ?) \>. */"," \ 1 ", $ email_from)."> \ r \ n ");
- $ Lastmessage = fgets ($ FP, 512 );
- If (substr ($ lastmessage, 0, 3 )! = 250 ){
- Fputs ($ FP, "mail from: <". preg_replace ("/. * \ <(. + ?) \>. */"," \ 1 ", $ email_from)."> \ r \ n ");
- $ Lastmessage = fgets ($ FP, 512 );
- If (substr ($ lastmessage, 0, 3 )! = 250 ){
- Runlog ('smtp ', "({$ _ g [setting] [mail] [server] }:{$ _ g [setting] [mail] [port]}) mail from-$ lastmessage ", 0 );
- Return false;
- }
- }
Copy code
Example 2:
- Unable to connect to the SMTP server
Copy code
Locate the code Sendmail Function
- If (! $ Fp = fsocketopen ($ _ g ['setting'] ['mail'] ['server'], $ _ g ['setting'] ['mail'] ['Port'], $ errno, $ errstr, 30 )){
- Runlog ('smtp ', "({$ _ g [setting] [mail] [server] }:{$ _ g [setting] [mail] [port]}) connect-unable to connect to the SMTP server ", 0 );
- Return false;
- }
Copy code
This error may be caused by the server disabling access to the external email server .. Here we will not illustrate each type of errors. The Troubleshooting logic is to locate the error logs and analyze the possible causes of the error.
Common Errors:
1. The server does not open port 25
Method: Check whether port 25 is enabled on the server. You can run the Telnet command to verify the port 25 and install Telnet locally (you can search for related tutorials online for installation methods ), run -- Enter cmd -- enter Telnet www.zhanhelp.com (or IP) port 25 to view the returned information. Or ask the Space Provider if port 25 is enabled.
2. Whether the SMTP server is correct and there are no spaces at the end. Whether to enable the SMTP server in the mailbox settings of the mailbox;
3. Whether the server can Set firewall filtering and other functions.
Discuz x3.2 setting registered email activation_enterprise mail failed to send email