PHP email headers (FROM)

Discussion in 'PHP' started by MrLeN, Jul 16, 2011.

  1. #1
    If you look on this page, you will find a tutorial on how to make PHP emails.

    http://www.w3schools.com/PHP/func_mail_mail.asp

    or this one:

    http://www.htmlite.com/php029.php

    I have also searched various other tutorials, and they all basically say the same thing about the "from" paramater. They all seem to just provide a way to put the mfrom email, but no from "name".

    My problem is, I don't want the "from" section to be just an email.

    ie: I don't want the email to say:

    From:

    I want it to say:

    From: My Name

    But I can't find anywhere that explains how to accomplish that.
     
    MrLeN, Jul 16, 2011 IP
  2. US Vice

    US Vice Peon

    Messages:
    3
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #2
    My tutorial on this: jabrannawaz.me/tutorials/viewtutorial.php?id=8
     
    US Vice, Jul 16, 2011 IP
  3. MrLeN

    MrLeN Well-Known Member

    Messages:
    406
    Likes Received:
    8
    Best Answers:
    0
    Trophy Points:
    120
    #3
    Your tutorial dosn't answer the question.

    It's like the 2 above. It displays the email as "from" (and not a name).

    Don't be so quick to spam your links when you don't even read the question!

    Thanks for wasting my time.
     
    MrLeN, Jul 16, 2011 IP
  4. MrLeN

    MrLeN Well-Known Member

    Messages:
    406
    Likes Received:
    8
    Best Answers:
    0
    Trophy Points:
    120
    #4
    For anyone that find this thread from Google, or a search or something. Here is the answer. I found it:

    This code will display the email only.
    
    $headers  = "From: email@gmail.com\r\n";
    
    Code (markup):
    This code will display a Sender:
    
    $headers  = "From: Website Name <email@gmail.com>\r\n";
    
    Code (markup):
     
    MrLeN, Jul 16, 2011 IP