Community Forums
Connect with us on LinkedIn
+ Reply to Thread
Results 1 to 11 of 11
  1. #1
    Member
    Join Date
    Aug 2006
    Posts
    9

    Default PHP(mail) Function

    Hi everyone,

    On the new server I'm working on, I can't seem to get the php mail() function to work properly. It was working fine on my old server, but now that I'm on this dedicated server it's not working. Is there something I need to set up in cPanel or WHM to enable this function to work properly?

    Thanks for any and all help you can give me!

  2. #2
    Member
    Join Date
    Mar 2003
    Posts
    160

    Default

    make sure your hostname is valid and resolves. #1 reason for mail to fail to send.

  3. #3
    Member
    Join Date
    Aug 2006
    Posts
    9

    Default

    I'm sorry, I'm not quite sure what you mean by "hostname is valid and resolves". Sorry, but could you explain in a little more "newbie-friendly" terms?

    Thanks!

  4. #4
    Member
    Join Date
    Mar 2003
    Posts
    160

    Default

    Hi, in WHM you have to set a hostname for your server. For example: server.mydomain.com

    A lot of people will use a fake name server. The name should be a verifiable name and should resolve. That's where I would check 1st.

  5. #5
    Member
    Join Date
    Aug 2006
    Posts
    9

    Default

    Ok, I've found what you're talking about but everything seems to be set up right. The thing is, another site on the same server uses the same code and works properly, but for this site the function is not working properly. Is there anything else I should be doing/checking?

  6. #6
    Member
    Join Date
    Aug 2006
    Location
    The Netherlands
    Posts
    28

    Default

    its with php security
    open php.ini and look for a line
    Code:
    register_globals
    And make sure its turned on! when its off you cant send mail with php
    Php have register_globals a while ago turned off in there new installations read at:
    www.php.net/register_globals

    Good luck
    http://www.hostingperfect.net where the hosting is perfect!

  7. #7
    Member
    Join Date
    Mar 2003
    Posts
    160

    Default

    you should then troubleshoot the mail logs,

    tail -f /var/log/exim_mainlog

    try sending a email, what error is logged. Look in /etc/httpd/logs/suexec_log , any errors for the site listed?

    Are permissions correct?

  8. #8
    Member
    Join Date
    Aug 2006
    Posts
    9

    Default

    I've made sure register globals is on, I've checked everything else, and everything seems fine but it's still not working.

    I've got 2 sites on the same server, and the function works on one of the sites but not on the other. would it have something to do with how I set the site up (the one I set up is the one where the php mail function isn't working, someone else set up the other site).

    I'm really stumped on this...if anyone has any more suggestions I could really use them!

    Thanks again!

  9. #9
    Member
    Join Date
    Jan 2005
    Posts
    139

    Default

    Quote Originally Posted by Dennisb1
    its with php security
    open php.ini and look for a line
    Code:
    register_globals
    And make sure its turned on! when its off you cant send mail with php
    Php have register_globals a while ago turned off in there new installations read at:
    www.php.net/register_globals

    Good luck

    Is this true? as far as I know it should send with it off or on - I would tail your server:

    tail -f /var/log/exim_mainlog

    When you send mail using php it or something should show up there and will let you know why it stopped.

    Another thing is if you dont have phpsuexec it will send as nobody, you may have it disabled in WHM and if you dont sometimes you'll find that some other host will not like this. If you dont have phpsuexec installed I would do so.
    Last edited by kistler; 10-11-2006 at 05:43 AM.

  10. #10
    Registered User
    Join Date
    Oct 2006
    Location
    Ameer Aka
    Posts
    1

    Default

    Will your email be flagged as spam if it doesn't come from the same email address as the from: field?

  11. #11
    Member
    Join Date
    Jan 2005
    Posts
    139

    Default

    if it comes from "nobody" (if phpsuexec is not installed right) it more then likely will – Sometimes if that domain is not hosted at your server/ip it maybe marked as spam also do you have an rDNS setup on your ip?

Similar Threads & Tags
Similar threads

  1. php mail function?
    By kobeeightjp in forum cPanel and WHM Discussions
    Replies: 2
    Last Post: 01-28-2010, 12:36 AM
  2. E-mail not going on same server sites using php mail() function
    By muzaffar in forum E-mail Discussions
    Replies: 1
    Last Post: 06-29-2009, 12:48 PM
  3. Php Mail Function / As nobody
    By ankushdawar in forum cPanel and WHM Discussions
    Replies: 9
    Last Post: 01-12-2004, 12:33 PM
  4. PHP and mail() function
    By Jontxu40 in forum cPanel and WHM Discussions
    Replies: 0
    Last Post: 06-11-2003, 01:10 PM
Linkedin       Facebook       Twitter       RSS       Flickr       YouTube