Results 1 to 10 of 14

Thread: Server "from" e-mail address

Hybrid View

Previous Post Previous Post   Next Post Next Post
  1. #1
    rlhanson's Avatar
    rlhanson is offline Master Glow Jedi
    Join Date
    Aug 2007
    Location
    Chapman, Kansas
    Posts
    531

    Default

    Thanks for the response!

    Would you happen to have an example on setting these headers in a php form processor?
    Thank you,
    Lynne Hanson
    RL Hanson-Online

  2. #2
    sergey is offline Master Glow Jedi
    Join Date
    Aug 2005
    Posts
    472

    Default

    If you want to send e-mails using PHP mail() function and change the from e-mail address then you may create a php.ini file in a directory where you are sending e-mails from and set the below variable in it:

    Code:
    sendmail_path="/usr/sbin/sendmail -t -i -f your-mail@domain.com"
    youre-mail@domain.com will need to be replaced with your address.
    Last edited by Matt; 10-13-2010 at 09:34 PM.

  3. #3
    charlesh's Avatar
    charlesh is offline Master Glow Jedi
    Join Date
    Aug 2006
    Location
    Atlanta, GA - better than you imagined it would be.
    Posts
    189

    Default Exim Config

    We were talking about this earlier, Lynne, and got me curious. I've noticed "On behalf of arjuna.harmonmediagroup.com" appearing in my client's sendmail generated messages. I saw that this was an Exim config thing. Is this to help get messages to the recipients without ending up in a spam box. Such as mail.hosteddomain.com coming from the sendmail on the server?

    Would / should you change this behavior?

    Charles

  4. #4
    Matt's Avatar
    Matt is offline GlowHost Administrator
    Join Date
    Jan 2005
    Location
    Behind your monitor
    Posts
    6,434

    Default

    The option you are referring to is from WHM > Exim Configuration:

    Set the Sender: Header when the mail sender changes the sender (-f flag passed to sendmail)
    Always set the "Sender:" header when the sender differs from the actual sender. Unchecking this will stop "On behalf of" data in Microsoft® Outlook, but may limit your ability to track abuse of the mail system.
    My interpretation of the description of this setting, checking it off in your WHM will set the -f header for you when using the PHP mail() function so that it does not need to be set in php.ini. I do not think that it actually works though.

    You can try enabling it in your WHM if it is not set already then retry your form processor and let us know how it goes.
    Send your friends and site visitors to GlowHost and get $125 plus bonus!
    GlowHost Affiliate Program | Read our Blog | Follow us on X |

  5. #5
    charlesh's Avatar
    charlesh is offline Master Glow Jedi
    Join Date
    Aug 2006
    Location
    Atlanta, GA - better than you imagined it would be.
    Posts
    189

    Default

    This is a great topic - I've seen so many ways to form headers for sendmail, but I've had good luck with the following:

    PHP Code:
    if (strtoupper(substr(PHP_OS,0,3)=='WIN')) { 
      
    $eol="\r\n"; 
    } elseif (
    strtoupper(substr(PHP_OS,0,3)=='MAC')) { 
      
    $eol="\r"; 
    } else { 
      
    $eol="\n"; 
    }  
    $headers .= 'From: Mr. Person<person@domain.com>'.$eol; 
    $headers .= 'Reply-To: Mr. Person<person@domain.com>'.$eol; 
    $headers .= 'Return-Path: Mr. Person<person@domain.com>'.$eol;    // these two to set reply address 
    $headers .= "Message-ID: <userid@".$_SERVER['SERVER_NAME'].">".$eol; 
    $headers .= "X-Mailer: PHP v".phpversion().$eol;          // These two to help avoid spam-filters 
    By your email above, I'll have to do some research to see if I need to add a "Sender:" header as well as the "From:". Maybe this has all changed since I last looked into it, but it is a good discussion.

    Lynne is always a good discussion starter

  6. #6
    Matt's Avatar
    Matt is offline GlowHost Administrator
    Join Date
    Jan 2005
    Location
    Behind your monitor
    Posts
    6,434

    Default

    I agree Charles, if you use [php] tags instead of [code] tags in your posts, the php will be easier to read. Do you want me to edit your post for you?
    Send your friends and site visitors to GlowHost and get $125 plus bonus!
    GlowHost Affiliate Program | Read our Blog | Follow us on X |

  7. #7
    charlesh's Avatar
    charlesh is offline Master Glow Jedi
    Join Date
    Aug 2006
    Location
    Atlanta, GA - better than you imagined it would be.
    Posts
    189

    Default

    Nah, should have done that in the first place. I'll post back with a "well-formed" header as well, working out the details now.

    Thanks,

Similar Threads

  1. Replies: 7
    Last Post: 09-23-2008, 04:14 PM
  2. Share a PHP coder - a "timeshare" solution that saves you $$$
    By Matt in forum General Announcements
    Replies: 0
    Last Post: 03-20-2006, 02:35 PM

Posting Permissions

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

1 2 3 4 5 6 7 8 9 10 11 12 13 14