Announcement

Collapse
No announcement yet.

PHP's mail() function

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • Nicholas Brown
    replied
    Originally posted by Kier
    This works for me:
    PHP Code:
    $to_address "My Friend <[email protected]>";
    $subject "Hello there";
    $from_address "From: My Name <[email protected]>";
    $message_body "bla bla bla bla bla bla bla bla bla bla.";

    mail($to_address,$subject,$message_body,$from_address); 
    Yep - That works for me too.
    I tried it on a number of free services along with some of the Paid Servers.
    Last edited by Nicholas Brown; Tue 27 Feb '01, 10:51pm.

    Leave a comment:


  • Kier
    replied
    This works for me:
    PHP Code:
    $to_address "My Friend <[email protected]>";
    $subject "Hello there";
    $from_address "From: My Name <[email protected]>";
    $message_body "bla bla bla bla bla bla bla bla bla bla.";

    mail($to_address,$subject,$message_body,$from_address); 

    Leave a comment:


  • psx-dude
    replied
    Not working for me either

    This isn't working for me either!!!!

    I shortened it to:

    mail("$sendto", "$subject", "$message");

    and it still doesn't work

    Leave a comment:


  • Shoe
    replied
    Originally posted by bmurray
    I think when you are running PHP as an Apache mod it shows up as nobody due to the PHP being considered user "nobody" by the server while it is running.

    When running PHP as CGI, the user shows up correctly due to how it runs.

    This would account for some people having different results, depending on their particular server config. I can't help as far as a solution though...I have not yet studied or used any of PHP's mail functions.


    Ben


    Change nobody to somebody

    Leave a comment:


  • Karl
    replied
    Try using X-From: Your Name <[email protected]> as the header. I can't remember off hand if it works or not.

    Leave a comment:


  • dwh
    replied
    Reply-To did not work for me. Neither did sendmail_from work. I wanted to follow the instructions for the sendmail configuration, but couldn't find any of the files needed. Any ideas anyone? If someone got step 6 and 7 to work, can you tell us dummies a sendmail step 6 and 7 for dummies, thanks?

    Leave a comment:


  • technobard
    replied
    Mail () Function Solution

    Hey, Guys.

    I had the same problem. The Reply-To: (see $extra below) fixed the problem.

    Hope this helps.

    $recipient = "Jimmy Jones <[email protected]>";
    $subject = "Testing the mail function";
    $message = "Hello!\n\nThis is the body of the message.\n\n";
    $extra = "From: [email protected]\r\nReply-To: [email protected]\r\n";

    mail ($recipient, $subject, $message, $extra);

    Technobard

    Leave a comment:


  • JohnM
    replied
    Doesn't help much for me

    Leave a comment:


  • chrispadfield
    replied
    found this:

    To all the people who are wondering why their email's return addresses often come out as [email protected]:

    Goto the [mail function] section of the php.ini file, and change your sendmail_from variable to whatever you want it to be. This should now work. (I haven't tried it with unix, but it can't hurt, so you might want to do it anyways)
    of course shared server it is not going to help

    Leave a comment:


  • Anscoop
    replied
    I believe that quote is incorrect
    Return Path works for me with mail()
    I have php compiled into apache.

    Leave a comment:


  • JohnM
    replied
    Originally posted by chrispadfield
    JohnM, when you send a newsletter through vbulletin does it come out as sent from user nobody as well?
    Yup, different server too.

    Leave a comment:


  • JohnM
    replied
    Only problem is I'm on a shared server, can't edit any config files or php.ini.

    Leave a comment:


  • bmurray
    replied
    Here is some info I just ran across...I haven't had a chance to check the supplied link, but it's better information that I could give


    [email protected]
    12-Apr-2000 10:28

    After much research, and more than a little time spent, I have found an answer to the "problem" of headers in received mail like From:[email protected]

    RFC822 makes it plain that the header "Return-path" is intended to be added to the message by the mail program at the destination(POP3), not at the source(SMTP). Adding it as a header to a mail() function will have no effect as mail() is the source.

    If you have PHP compiled into Apache, then PHP mail() sends email to sendmail as the owner of the process which, of course, is 'nobody'. So sendmail will use 'nobody' in the "From" field of the sendmail generated portion of the header.
    The solution is to follow the instructions in the sendmail configuation to reverse-map outgoing mail to "[email protected]". Here is the URL to those instructions: http://www.sendmail.org/virtual-hosting.html
    Follow instructions 6 and 7 and you will have no further problems.

    Leave a comment:


  • chrispadfield
    replied
    really.. so any big company that uses PHP to send mailing lists must have PHP run as a cgi.

    JohnM, when you send a newsletter through vbulletin does it come out as sent from user nobody as well?

    Leave a comment:


  • bmurray
    replied
    I think when you are running PHP as an Apache mod it shows up as nobody due to the PHP being considered user "nobody" by the server while it is running.

    When running PHP as CGI, the user shows up correctly due to how it runs.

    This would account for some people having different results, depending on their particular server config. I can't help as far as a solution though...I have not yet studied or used any of PHP's mail functions.


    Ben


    Leave a comment:

widgetinstance 262 (Related Topics) skipped due to lack of content & hide_module_if_empty option.
Working...
X