#1
  1. No Profile Picture
    Junior Member
    Devshed Newbie (0 - 499 posts)

    Join Date
    May 2000
    Posts
    6
    Rep Power
    0
    Hi all,

    Does anyone know how to use the Mail function in PHP3 and set the from / reply to field to something other than nothing like I keep getting?

    Here's my line of code:
    mail($recipient, $subject, $body, "From: me@emailnReply-To: me@emailnX-Mailer: PHP/" . phpversion());

    But what happens is a get a reply to 'Noboby' and the email I want in the reply field appears in the body.
  2. #2
  3. No Profile Picture
    Junior Member
    Devshed Newbie (0 - 499 posts)

    Join Date
    May 2000
    Posts
    4
    Rep Power
    0
    The following works for me:

    $mailto = "Username1<useremail1@domain.com>";
    $subject = "Subject Line for Mail Message";
    $body = "Body Line 1n";
    $body .= "Body Line 2n";
    $body .= "Body Line 3n";
    $body .= "Body Line 4n";
    $header = "From: Username2<useremail2@domain.com>n";

    mail($mailto, $subject, $body, $header);

    I would assume you can add the following for the reply-to portion:

    $header. = "Reply-To: Username3<useremail3@domain.com>n";

    Hope this helps,

    Maven
  4. #3
  5. No Profile Picture
    Junior Member
    Devshed Newbie (0 - 499 posts)

    Join Date
    May 2000
    Posts
    6
    Rep Power
    0
    Cheers for the help.
    It didn't work though - I think it's just because computers hate me. Oh well.
  6. #4
  7. No Profile Picture
    Junior Member
    Devshed Newbie (0 - 499 posts)

    Join Date
    May 2000
    Posts
    4
    Rep Power
    0
    From your original post you will need to add <> around the actual e-mail address you want to use. I would assume the msg you are receiving with the nobody@domain address looks similar to:

    me@email<nobody@domain.com>

    try:

    "From: me@email<me@email>n"
    "Reply-To: me@email<me@email>n"
  8. #5
  9. No Profile Picture
    Junior Member
    Devshed Newbie (0 - 499 posts)

    Join Date
    Jun 2000
    Posts
    14
    Rep Power
    0
    Hi there,

    i've encountered that generally the from-mail option doesnt work, when you dont include an extension.
    so instead of "me@email" try "me@email.com" and see if that works.
    good luck!
  10. #6
  11. No Profile Picture
    Registered User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Oct 1999
    Posts
    4
    Rep Power
    0
    forgot to type in the message,
    well i agree with porcupine

    [This message has been edited by JaMmed (edited June 01, 2000).]
  12. #7
  13. No Profile Picture
    Contributing User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Apr 2000
    Location
    In nederland
    Posts
    41
    Rep Power
    15

    mail("someone@somehost.com", "the subject", "nnntest","From:webmaster <webmaster@$SERVER_NAME>nReply-To:webmaster <webmaster@$SERVER_NAME>nX-Mailer: PHP/" . phpversion());

    For some reason this mail works fine, but doesn't arrive?

    server error:
    Email adres sender doesn't exists?
    ... while talking to mail.somehost.com.:
    >>> MAIL From:<nobody@localhost.localdomain> SIZE=46
    <<< 501 <nobody@localhost>... Sender domain must exist
    501 someone@somehost.com... Data format error


    Does somebody has a clue?
  14. #8
  15. No Profile Picture
    Junior Member
    Devshed Newbie (0 - 499 posts)

    Join Date
    May 2000
    Posts
    6
    Rep Power
    0
    Thanks for all the help. I think it was just a bug in my version of PHP! I ended up bouncing it out to an NT box and using ASP-Mail to send it. Not the nicest way to do it but it works now.

    [This message has been edited by Porcupine (edited June 01, 2000).]

Similar Threads

  1. Help with script
    By akastarlight in forum Perl Programming
    Replies: 1
    Last Post: February 6th, 2004, 06:55 AM
  2. mail() not working with ISP's mail server
    By wjones8050 in forum PHP Development
    Replies: 2
    Last Post: January 9th, 2004, 02:47 PM
  3. FROM address using sendmail in perl
    By ebonit in forum Perl Programming
    Replies: 14
    Last Post: August 21st, 2003, 11:41 AM
  4. mail() in php3.. /r/n shows up literally (no newlines)
    By JunkCookie in forum PHP Development
    Replies: 2
    Last Post: August 20th, 2003, 11:14 AM
  5. Problems with MIME type in mail headers
    By hccfilms in forum PHP Development
    Replies: 1
    Last Post: October 14th, 2002, 01:54 AM

IMN logo majestic logo threadwatch logo seochat tools logo