Community Forums
Connect with us on LinkedIn
+ Reply to Thread
Results 1 to 6 of 6
  1. #1
    Secret Agent
    Guest

    Default PHP function mail() is not working

    Below is a part of code from the test script:
    ---
    $mt = $_POST['mt']; // address
    $txt = $_POST['txt']; // message body
    $u = system("whoami", $ret_val);
    $h = system("hostname", $ret_val);
    $sFrom = "From: no-reply@domain.com";

    if (mail($mt, "Mail from tm.php: $u" . "@" . $h, $txt, $sFrom))
    echo "Mail has been sent to $mt<br>";
    else echo "someting wrong.. mail hasn't been sent..<br>";


    I did a test, no errors, no message received, nothing in mail queue. "Prevent user nobody.." is disabled as well. The client claims it was working fine for a few days after I disabled "prevent user nobody" until today it stopped working. Strangely, no changes have been made to the server since then otherwise.

    All these are enabled (and have been the whole time)

    Always set the Sender: header when the sender is changed from the actual sender.
    Verify the existance of email senders.
    Use callouts to verify the existance of email senders.
    Discard emails for users who have exceeded their quota

    Using php 4.4.1 as well

  2. #2
    Member
    Join Date
    Jan 2006
    Posts
    26

    Default

    Aything in the exim reject log?

  3. #3
    Secret Agent
    Guest

    Default

    I didn't see any show up when I tailed it.

  4. #4
    Member
    Join Date
    Jan 2005
    Posts
    34

    Default

    While coding a mail script I noticed that for some reason the mail function was very picky about the format of the function while being called.

    I could not get it to send with anything other than

    mail($to, $subject, $message, $headers);

    you can change the variable name, but not the order.

    Also, for some reason I also noticed that it does not want to send outside of the server because allthough the suexec and phpsuexec are installed, the script still wants to send as nobody. I had to create a forwarder on the domain, and send the mail to the address resident on the server, and let the forwarder take it from there.

    Hope that this helps.

    Mike

  5. #5
    cPanel Partner NOC cPanel Partner NOC Badge
    Join Date
    Apr 2002
    Posts
    686
    cPanel/Enkompass Access Level

    DataCenter Provider

    Default

    dont know if this is related or not but i have a reseller who uses various php formmailers and they all went dead about 3 weeks ago... no errors nothing in the logs either...

    the forms work and redirect to a thankyou page but no emails are sent

  6. #6
    Registered User
    Join Date
    Oct 2004
    Posts
    2

    Default php mail() not working - segmentation fault

    I had same problem no php forms could send email using mail().

    1. Delete the file /etc/eximmailtrap and set eximmailtrap=0 in /var/cpanel/cpanel.config (this seems to manually turnoff the prevent nobody from sending under tweak settings). Before I did this /usr/sbin/sendmail was giving me a segmentation fault.

    2. If you have done step 1 and mail still doesn't work then reinstall exim using:
    /scripts/eximup --force

    That worked for me, hope this helps someone else!

Similar Threads & Tags
Similar threads

  1. php function mail () not working within my account
    By chike in forum New User Questions
    Replies: 7
    Last Post: 06-07-2010, 02:03 PM
  2. php mail() function not working
    By nowashburn in forum E-mail Discussions
    Replies: 2
    Last Post: 12-11-2008, 09:00 PM
  3. PHP Mail Function Not Working
    By jlimited in forum cPanel and WHM Discussions
    Replies: 7
    Last Post: 07-08-2006, 08:12 PM
  4. PHP mail function not working, Nobody user prevented.
    By antodeepak in forum cPanel and WHM Discussions
    Replies: 0
    Last Post: 01-25-2006, 09:00 AM
  5. php mail function is not working
    By shann in forum cPanel and WHM Discussions
    Replies: 0
    Last Post: 11-23-2002, 04:33 PM
Linkedin       Facebook       Twitter       RSS       Flickr       YouTube