SitePoint Sponsor

User Tag List

Results 1 to 3 of 3
  1. #1
    SitePoint Member
    Join Date
    Jan 2005
    Location
    dark alleys
    Posts
    19
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    PHP mail() - can I change 'from' address?

    We all know, when we open our email, we can see a person's name as the sender and not just an email address.

    I've set up a feedback form on a website using PHP. The emails that come in show a "www" long address as the sender, which show it is coming from our server.

    Is there a way in PHP I can have the sender be displayed in the recipient's inbox as "Compay Feedback User" (or any given word or phrase?)
    Last edited by jawn_tech; Feb 2, 2005 at 13:03. Reason: (typo)

  2. #2
    SitePoint Zealot
    Join Date
    Jan 2005
    Posts
    147
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Yep,

    PHP Code:
    mail($to,$subject,$message,"From: you@you.com"); 
    you can also ut it in a header var like most people do so you'd get the same result.


    PHP Code:
    $header "From: you@you.com";
    mail($to,$subject,$message,$header); 
    The idea of adding it in a header var is so that you can apend many more header requests with it.

  3. #3
    SitePoint Member
    Join Date
    Jan 2005
    Location
    dark alleys
    Posts
    19
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Thanks IronCode.

    You put me on the right path. I worked with it and had to tweak it a bit -- maybe just my server, but

    I ammeded it as follows:

    Code:
    $header = "From: Feedback User <companyname@company.net>";
    mail($toaddress, $subject, $mailcontent, $header);
    (I added the < > )

    Now the display address just shows "Feedback User" in Outlook.

    Thanks!


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •