Community Forums
Connect with us on LinkedIn
Community Notice
+ Reply to Thread
Results 1 to 6 of 6
  1. #1
    Member
    Join Date
    Oct 2004
    Posts
    11

    Default PHP script sends email as Nobody

    I am having problems PHP scripts. When the php script tries to send out an email, it sends the email as "nobody@MYHOSTNAME.com" when the web address and MYHOSTNAME are totally different. So to solve this problem, I turn on "Prevent the user 'nobody' from sending out mail to remote addresses (php and cgi scripts generally run as nobody if you are not using phpsuexec and suexec respectively.)"

    After doing that, emails get stuck in the Mail Queue of the server. It says the email it was trying to send to has an "unrouteable mail domain".

    I tried the PHPsuexec and it fixed the problem. However, I would like to keep phpsuexec off, if possible.

    Bascially the "Return-path:" and "Received:" says it's from "nobody@myhostname.com" . Is there a way to fix this? I am reading and it seems to be a limitation of PHP, but there must be a solution because I've used other hosts without phpsuexec and I was able to send out mail with PHP.

  2. #2
    ckh
    ckh is offline
    Member
    Join Date
    Dec 2003
    Posts
    319

    Default

    I do something like:

    $return="returnaddress@somewhere.com";
    $email="SendToSomeone@hisdomain.com";
    $subject="blah blah blah";
    $body="more blah blah blah";

    mail("$email", $subject, $body, "FROM: $returnemail","-f$returnemail");


    This makes the 'return path' & 'from' to contain the email address returnaddress@somewhere.com

    I also have:

    trusted_users = nobody
    untrusted_set_sender = *

    in the first box of the exim configuration editor.....

    Chris

  3. #3
    Member
    Join Date
    Oct 2004
    Posts
    11

    Default

    hm... I'm trying out the

    trusted_users = nobody
    untrusted_set_sender = *

    in the exim conf. editor, but it doesn't seem to work. The php script is still trying to send out the mail using "nobody@myhostname.com", so the email is not being sent and it's going into my Mail Queue.

    I forgot the say that this is not a custom PHP script, so i can't try out that code in PHP. I'm using Drupal which is a CMS. I am pretty sure Drupal is configured correctly. I would imagine this is not Drupal's fault but it is that I have not configured something properly.

  4. #4
    Member
    Join Date
    Jan 2003
    Posts
    276

    Default

    as long as you have the setting
    Prevent the user 'nobody' from sending out mail to remote addresses (php and cgi scripts generally run as nobody if you are not using phpsuexec and suexec respectively.)
    checked in WHM the server will not send emails from the user nobody.
    www.ccccanada.com
    Web and Server Hosting

  5. #5
    Member
    Join Date
    Oct 2004
    Posts
    11

    Default

    ccccanada: I had the whole concept of PHP mail sending out as 'nobody' and phpsuexec mixed up in my head and I was expecting it to do something that it can't. Thanks for clearing it up.

  6. #6
    Member
    Join Date
    Jan 2003
    Posts
    276

    Default

    No problem at all.

    By looking at your post it finaly made me search for this problem and found the other post which had the solution so it helped me as well.
    www.ccccanada.com
    Web and Server Hosting

Similar Threads & Tags
Similar threads

  1. Autoresponder sends one email per address
    By bluepine in forum cPanel and WHM Discussions
    Replies: 2
    Last Post: 10-28-2009, 11:58 PM
  2. What is the script that sends disk/bw notification emails?
    By electric in forum cPanel and WHM Discussions
    Replies: 6
    Last Post: 09-25-2008, 04:05 PM
  3. Replies: 4
    Last Post: 03-21-2008, 01:02 PM
  4. Server sends email when load is above 50 - How?
    By jols in forum cPanel and WHM Discussions
    Replies: 1
    Last Post: 08-30-2007, 12:45 PM
  5. Replies: 1
    Last Post: 06-20-2003, 02:57 PM
Linkedin       Facebook       Twitter       RSS       Flickr       YouTube