Phpmailer/zendmail cant send mail
I just move my all application to a new server(clound server) with whm/cpanel, I have root access to WHM.
My websites cant send mail via php libraries like, phpmailer, zendmail, etc, email just work if I use the native mail function, I do some research on Google and find some tips like enable by iptables.
using the command:
# setsebool -P httpd_can_sendmail 1
but when I do this command show me that selinux is disabled, so I try to enable selinux and follow the tutorial 'setsebool ....' and cant send email with phpmailer too, and more error occurred, my email account that I have setup on thunderbird stop work(msg: cant connect to host mail.mywesite.com), so I go back and disable selinux again, and thunderbird work again.
also before I disable selinux I disable httpd_can_sendmail:
# setsebool -P httpd_can_sendmail 0
so the configuration is to default again.
I dont know why selinux is disabled by default on whm/cpanel installation, and I dont know if its is safe enable it. because if it is disable by default it have to be some reason.
The instalation is on a cloud server, and I have root full access.
How can I enable to send email with php libraries like phpmailer and zendmail??
-
Hello :) It's normal to see SELinux disabled by default, as it's not compatible with cPanel/WHM without a manual configuration. I'm not sure which tutorial you are following that advises enabling it to allow for sending email through PHP scripts, but it's not going to address the issue. Instead, do you notice any error messages in /var/log/exim_mainlog or /usr/local/apache/logs/error_log or in an error_log file within the account when attempting to send email through the PHP script? Thank you. 0 -
Hello :) It's normal to see SELinux disabled by default, as it's not compatible with cPanel/WHM without a manual configuration. I'm not sure which tutorial you are following that advises enabling it to allow for sending email through PHP scripts, but it's not going to address the issue. Instead, do you notice any error messages in /var/log/exim_mainlog or /usr/local/apache/logs/error_log or in an error_log file within the account when attempting to send email through the PHP script? Thank you.
This is the tutorial:0 -
I saw the log files and: error_log = only have messages about file dont exist and error 404; exim_mainlog = has a lot off info but not about this type of error. 0 -
Try comparing the output of the following commands between the two servers and see if you notice a difference on the server where PHP mail fails to send out: /usr/local/cpanel/bin/rebuild_phpconf --current php -v
Thank you.0 -
Try comparing the output of the following commands between the two servers and see if you notice a difference on the server where PHP mail fails to send out:
/usr/local/cpanel/bin/rebuild_phpconf --current php -v
Thank you.
I compare the two php version and the server 1 (that send email) is with php 5.5 and the server 2 (that not send mail) was with php 5.3, so I do an update to php 5.5 in easy apache > tweak tool, but still hava problem.0 -
I compare the two php version and the server 1 (that send email) is with php 5.5 and the server 2 (that not send mail) was with php 5.3, so I do an update to php 5.5 in easy apache > tweak tool, but still hava problem.
Did you run the first command to compare the PHP handlers? Thank you.0 -
Did you run the first command to compare the PHP handlers? Thank you.
server 1 is suphp and the server 2 is fast cgi. the error is on server 2 with fast cgi. I will change it and report here.0 -
server 1 is suphp and the server 2 is fast cgi. the error is on server 2 with fast cgi. I will change it and report here.
I change it to suphp and still have problem: connection time out. note: if I run the same script with smtp configurantion on xammp(my pc) it work fine, but when I upload the script to server do not work and get time out error.0 -
It's highly likely this is an issue with your script that's outside our scope of support, however feel free to open a support ticket so we can take a look and determine if there are any obvious problems. You can post the ticket number here so we can update this thread with the outcome. Thank you. 0 -
seriously you will blame it on my script? 0 -
seriously you will blame it on my script?
Look, if I put this script on other server with the same configuration, and only change smtp login details will work fine.0 -
Hello :) It's difficult to pinpoint any specific server configuration issues without access to the affected system. Thus, opening a support ticket would allow us to take a closer look and see if we notice anything out of the ordinary. While it's possible that it's a server configuration issue, there's no way for us to investigate further unless you open a support ticket. Feel free to post the ticket number here and we can update this thread with the outcome. Thank you. 0 -
Hello :) I've been unable to locate a support ticket for this issue. Were you able to open a support ticket or address the issue through another method? I look forward to your response. Thank you. 0
Please sign in to leave a comment.
Comments
13 comments