Thursday, January 27, 2011

Sendmail/Postfix Adding Linux User Account to From header line.

I just moved to a new server, we're using postfix now instead of sendmail. The issue is that mail sent from PHP using the mail command (which interfaces with /usr/sbin/sendmail/) shows up in the clients inbox, and the 'friendly' name shown is Apache. Which is obviously confusing to an end user, causing them to wonder why they are being emailed by a native american indian tribe.

Postfix (sendmail wrapper) is taking whatever you put in the -f parameter, and tacking on the Linux user who called the program. So the from line in the header winds up looking like this:

From: sales@whatever.com (Apache)

Causing the client to use whats in the parenthesis as the 'friendly name'.

I could manually set the from header in php, but i'd rather just stop postfix from doing that, because i'd have to edit php code in a hundreds of places.

  • My understanding of your issue is that the "GCOS" field of the password entry for the apache user is being sent. Do you really need a "friendly name" as you call it? If not, have you thought of removing the GCOS name from the apache password entry? Then there should be no "friendly" name attached to these email notes.

    profitphp : Wow, that was the last place i thought the issue would be. I just edited my passwd file and cleared the "GCOS" field, works as expected now. thanks!
    From mdpc

0 comments:

Post a Comment