The Community Forums

Interact with an entire community of cPanel & WHM users!
  1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

Phpmailer/zendmail cant send mail

Discussion in 'E-mail Discussions' started by Tocom, Aug 13, 2015.

  1. Tocom

    Tocom Member

    Joined:
    Jun 4, 2015
    Messages:
    8
    Likes Received:
    0
    Trophy Points:
    1
    Location:
    paraguay
    cPanel Access Level:
    Root Administrator
    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??
     
  2. cPanelMichael

    cPanelMichael Forums Analyst
    Staff Member

    Joined:
    Apr 11, 2011
    Messages:
    30,854
    Likes Received:
    676
    Trophy Points:
    113
    cPanel Access Level:
    Root Administrator
    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.
     
  3. Tocom

    Tocom Member

    Joined:
    Jun 4, 2015
    Messages:
    8
    Likes Received:
    0
    Trophy Points:
    1
    Location:
    paraguay
    cPanel Access Level:
    Root Administrator
    This is the tutorial: http://gistpages.com/2013/09/14/php...to_connect_to_server_permission_denied_13_fix

    I have another servers with whm/cpanel and I do some tests with the same script and work fine, also I check for selinux and it is disabled too, but on this other all work fine.

    I will see the logs and paste here.
     
  4. Tocom

    Tocom Member

    Joined:
    Jun 4, 2015
    Messages:
    8
    Likes Received:
    0
    Trophy Points:
    1
    Location:
    paraguay
    cPanel Access Level:
    Root Administrator
    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.
     
  5. cPanelMichael

    cPanelMichael Forums Analyst
    Staff Member

    Joined:
    Apr 11, 2011
    Messages:
    30,854
    Likes Received:
    676
    Trophy Points:
    113
    cPanel Access Level:
    Root Administrator
    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:

    Code:
    /usr/local/cpanel/bin/rebuild_phpconf --current
    php -v
    Thank you.
     
  6. Tocom

    Tocom Member

    Joined:
    Jun 4, 2015
    Messages:
    8
    Likes Received:
    0
    Trophy Points:
    1
    Location:
    paraguay
    cPanel Access Level:
    Root Administrator
    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.
     
  7. cPanelMichael

    cPanelMichael Forums Analyst
    Staff Member

    Joined:
    Apr 11, 2011
    Messages:
    30,854
    Likes Received:
    676
    Trophy Points:
    113
    cPanel Access Level:
    Root Administrator
    Did you run the first command to compare the PHP handlers?

    Thank you.
     
  8. Tocom

    Tocom Member

    Joined:
    Jun 4, 2015
    Messages:
    8
    Likes Received:
    0
    Trophy Points:
    1
    Location:
    paraguay
    cPanel Access Level:
    Root Administrator
    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.
     
  9. Tocom

    Tocom Member

    Joined:
    Jun 4, 2015
    Messages:
    8
    Likes Received:
    0
    Trophy Points:
    1
    Location:
    paraguay
    cPanel Access Level:
    Root Administrator
    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.
     
  10. cPanelMichael

    cPanelMichael Forums Analyst
    Staff Member

    Joined:
    Apr 11, 2011
    Messages:
    30,854
    Likes Received:
    676
    Trophy Points:
    113
    cPanel Access Level:
    Root Administrator
    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.
     
  11. Tocom

    Tocom Member

    Joined:
    Jun 4, 2015
    Messages:
    8
    Likes Received:
    0
    Trophy Points:
    1
    Location:
    paraguay
    cPanel Access Level:
    Root Administrator
    seriously you will blame it on my script?
     
  12. Tocom

    Tocom Member

    Joined:
    Jun 4, 2015
    Messages:
    8
    Likes Received:
    0
    Trophy Points:
    1
    Location:
    paraguay
    cPanel Access Level:
    Root Administrator
    Look, if I put this script on other server with the same configuration, and only change smtp login details will work fine.
     
  13. cPanelMichael

    cPanelMichael Forums Analyst
    Staff Member

    Joined:
    Apr 11, 2011
    Messages:
    30,854
    Likes Received:
    676
    Trophy Points:
    113
    cPanel Access Level:
    Root Administrator
    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.
     
  14. cPanelMichael

    cPanelMichael Forums Analyst
    Staff Member

    Joined:
    Apr 11, 2011
    Messages:
    30,854
    Likes Received:
    676
    Trophy Points:
    113
    cPanel Access Level:
    Root Administrator
    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.
     
Loading...

Share This Page