Need help to create from header in phpmail()

Discussion in 'PHP' started by MikeLugar, Feb 15, 2011.

  1. #1
    This is what i have so far and I need my email address to appear in the from field on the email. It works as of now but with no from sender.

    $subject = 'ALERT ';

    $headers = 'MIME-Version: 1.0' . "\r\n";
    $headers .= 'Content-type: text/html; charset=iso-8859-1' . "\r\n";


    // Mail it
    mail($to, $subject, $limitedtextarea, $headers);
     
    MikeLugar, Feb 15, 2011 IP
  2. jwitt98

    jwitt98 Peon

    Messages:
    145
    Likes Received:
    9
    Best Answers:
    0
    Trophy Points:
    0
    #2
    Give this a try
    mail($to, $subject, $message, $headers, "-f ");
     
    jwitt98, Feb 15, 2011 IP
  3. trackpaps

    trackpaps Peon

    Messages:
    11
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #3
    hi i did this ... seems to be working
    $headers = 'MIME-Version: 1.0' . "\r\n";
    $headers .= 'Content-type: text/html; charset=iso-8859-1' . "\r\n";
    $headers .= "Reply-To: $name <$email>" . "\r\n";
    $headers .= "From: SOME TEXT<email@yourdomain.com>\r\n" . "X-Mailer: php";

    the 'from' works but if somebody looks at the details they can see source of the mail ... is there a way to hide it?
     
    trackpaps, Feb 15, 2011 IP
  4. MikeLugar

    MikeLugar Well-Known Member

    Messages:
    1,453
    Likes Received:
    36
    Best Answers:
    2
    Trophy Points:
    150
    #4
    Thanks that worked Great! @trackpaps that would probably work as well thanks for the response.
     
    MikeLugar, Feb 15, 2011 IP
  5. way2tech

    way2tech Member

    Messages:
    245
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    26
    #5
    hi,
    i accepted in all answers.
    Thanks..
     
    way2tech, Feb 16, 2011 IP