Page 1 of 2 12 LastLast
Results 1 to 10 of 14

Thread: Server "from" e-mail address

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

    Default Server "from" e-mail address

    Is there any way to change the from e-mail address that displays in message headers processed through a domain?

    Example: user@server.name.net; on behalf of Company Name

    I think this is a server response as all my clients feedback forms have this entry. Is there any way to have it say info@domainname.com instead?
    Thank you,
    Lynne Hanson
    RL Hanson-Online

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

    Default

    That behavior generally comes from if your scripts are using the PHP mail() function. Using the PHP mail() function to send email sometimes has options in the script admin to set the correct headers, but most scripts lack this functionality.

    If the script has an option to send email using SMTP instead of PHP, use that option and it will send for the desired address instead of user@some.hostname.com

    You will need to configure a real email address in your control panel, then supply the script with the correct username and password for that email address the same way you would setup your email program.
    Last edited by Matt; 10-11-2010 at 07:50 PM.
    Send your friends and site visitors to GlowHost and get $125 plus bonus!
    GlowHost Affiliate Program | Read our Blog | GlowHost's Facebook | Follow us on Twitter | GlowHost on Google+

  3. #3
    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

  4. #4
    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.

  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 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

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

    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 | GlowHost's Facebook | Follow us on Twitter | GlowHost on Google+

  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

    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

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

    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 | GlowHost's Facebook | Follow us on Twitter | GlowHost on Google+

  9. #9
    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,

  10. #10
    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 Sendmail Function

    Well, Interesting findings - take a look at the following code -
    PHP Code:
      function send_mail($myname$myemail$contactname$contactemail$subject$message
                  {
                  
    $headers .= "MIME-Version: 1.0\n";
                  
    $headers .= "Content-type: text/html; charset=iso-8859-1\n";
                  
    $headers .= "X-Mailer: PHP/" phpversion()."\n";
                  
    $headers .= "Reply-To:<".$myemail.">\n";
                  
    $headers .= "From:".$myname."<".$myemail.">\n";

                  
                  return(
    mail("\"".$contactname."\" <".$contactemail.">"$subject$message$headers,"-finfo@harmonmediagroup.com"));
                    } 
    At first I just passed in "-finfo@harmonmediagroup.com" to the php mail function. Still didn't get anything different in the "Return-Path:" header - server generated. This proves that you can't override the EXIM configuration by passing a parameter.

    Only after unchecking the "Set the Sender: Header when the mail sender changes the sender" option in WHM - MAIN>>Service Configuration>>Exim Configuration Editor under Mail, was I able to sucessfully pass on the additional parameter "-finfo@harmonmediagroup.com" and have it come up as such in the header's Return Path, which ultimately feeds into Oulook's "on behalf of" verbiage.

    Not setting it in the mail function resorted to the default server username, but still did not generate the outlook "on behalf of" message in outlook.

    Bottom line, I think I'll try it without the check box for a while - don't think it hurts anything.

Page 1 of 2 12 LastLast

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

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
  •  

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