Results 1 to 10 of 14

Thread: Server "from" e-mail address

Hybrid View

Previous Post Previous Post   Next Post Next Post
  1. #1
    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 |

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

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

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

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

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

    Default

    Interesting. I still think there is another way around it in the script itself. I will have to try and find how we did this in the past.

    Any reason you want to use charset=iso-8859-1 instead of UTF-8 ?
    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

    I guess I could change it now, I used it from another site I did (copied over) back in 2006 and we were having serious email problems with trying to get attachments through to end-users without being blacklisted. Somehow, I think I tried everything at the time to get it to pass. In the end, we just went to a "send you the link with a get statement" download type thingy. I could change it now to get with the times - thanks for pointing that out.

Similar Threads

  1. Replies: 7
    Last Post: 09-23-2008, 05: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, 03: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