[clue-tech] Postfix config: localhost vs. internet mail

Jed S. Baer thag at frii.com
Fri Nov 25 19:38:38 MST 2005


I'm trying to fix up a small problem here with differentiating mail local
to my machine vs. mail going out via SMTP.

The thing is, my machine has a fictional domain name. I had to call it
something, eh? Normally, this causes no problems, as postfix just delivers
local mail locally. But on rare occassions, typically when I'm testing
having a PHP script send something, usually to myself as
webmaster at cluedenver.org, it has to deliver via inet. Mostly, this isnt' a
problem. Postfix (I guess it's postfix doing it, I suppose it could be
PHP) generates a "From:" header by concatenating the username Apache is
running under with the result of gethostbyname() or its moral equvalent.
So I get a From: header which looks like
apache at myhostname.fictionaldomain.tld. So (using the above example)
postfix duly connects to the CLUE mail server and delivers the message. On
the CLUE server, postfix duly figures out where to send mail for
"webmaster", and tries to ship it back to me via FRII. FRII, however
(using it's "Mailarmory" spam filtering) rejects it because
fictionaldomain.tld doesn't exist.

Okay. So I look in the main.cf file for possibilities. Setting $myorigin
looks great for sending mail non-locally. Unfortunately, local mail, such
as the output from the logwatch demon, just gets sent to "root" -- no
domain specified. With $myorigin set to "frii.com", postfix appends
"frii.com" to "root", and that's not what I want.

So I'm trying to figure out what my "best practice" here might be. Is
there a way to tell postfix to just deliver locally any mail with no
domain specified for the recipient, but to append a valid domain name when
it creates the "From:" header for everything else?

Or is this not even a postfix issue? If not, then I don't quite understand
the purpose of the comment for the $myorigin variable:

"The myorigin parameter specifies the domain that locally-posted mail
appears to come from. The default is to append $myhostname, which is fine
for small sites. [...] myorigin also specifies the default domain name
that is appended to recipient addresses that have no @domain part"

I also assume, perhaps incorrectly, that postfix generates a "From:"
header only if it isn't already present. While this presents a possible
workaround, I don't want to use it. I can specify additional headers for
the php mail() function, one of which could certainly be "From:". But this
would mean I'd have to remember to change the code before checking it in
to CVS and putting it into production. And I prefer not to have to do
that. I might forget.

jed

-- 
http://s88369986.onlinehome.us/freedomsight/
Key fingerprint = B027 FEFB 4281 CC72 67D1  4237 F2D0 D356 077A A30E
... it is poor civic hygiene to install technologies that could someday
facilitate a police state. -- Bruce Schneier
_______________________________________________
CLUE-tech mailing list
CLUE-tech at cluedenver.org
http://cluedenver.org/mailman/listinfo/clue-tech



More information about the clue-tech mailing list