JP Vossen on 2 Mar 2010 21:55:26 -0800

[Date Prev] [Date Next] [Thread Prev] [Thread Next] [Date Index] [Thread Index]

Re: [PLUG] Postfix address re-write rules?

> Date: Mon, 1 Mar 2010 15:40:57 -0500
> From: "Claude M. Schrader" <>
> Subject: Re: [PLUG] Postfix address re-write rules?
> On 15:32 Mon 01 Mar     , JP Vossen wrote:
>> Fair warning: I haven't Googled this yet.  I have a hunch I'll find a 
>> bunch of stuff that is almost, but not quite, completely wrong for what 
>> I'd like to do.
>> Problem: there is an external email address to which I can send email 
>> but my wife can't.  This is due to an incredibly FUBAR remote mail 
>> server, over which I have no control and which has not improved in 
>> years, nor will it.  Ever.  :-(  Note we're both using my server, on my 
>> domain, mine works because of a special exception on the remote side 
>> that we can't get duplicated.  (Don't ask.)
>> Work-around: when my wife replies to that address, she can manually 
>> change it to a different one that works.  Except sometimes she forgets, 
>> and the broken server never send a failure message either so the reply 
>> just vaporises.
>> Proposed Solution: Ideally, if my wife sends an email to the bad address 
>> (due to hitting reply and forgetting to change it), Postfix will 
>> re-write with a good address, but if I send it will do nothing.  Worst 
>> case, I just re-write everything going to the bad address with the good one.
>> IOW, ideally:
>> 	me --> = just works
>> 	wife --> --} postfix changes to = works
>> Anyone have any clues?  I'm using stock Lenny Postfix 2.5.5-1.1 if that 
>> matters.

Obviously I should have mentioned that she's using stock Thunderbird on 
Hardy.  Tweaking at MUA didn't even occur to me, but would be perfect if 

> Possible Solution 1: defriend that person. You must *really* like
> that person to deal with such a broken mailserver

It's the email server where my Mom works...  What can I say?  I've 
reported all their problems in painful detail, with citations to the 
RFC, several times over the years.  Given the nature of her department, 
this brokenness is a major problem for them, but no one has ever gotten 
IT to do diddly about it.  So I'm done, except for trying to kludge 
around it.

As noted, right now, I can send to her at work, which is sometimes 
useful, but my wife can't *and the message just vanishes with no 
bounce*, so no one knows about the miss.  That can cause scheduling and 
other issues, but is actually pretty rare, so my wife doesn't want me to 
spend too much time on it.

> Possible Solution 2: I'm not sure what MUA your wife uses, but I
> know with mutt you can set up hooks to automatically set the from
> address based some some arbitrary criteria. There may be a thunderbird
> extention to do the same?

Never even occurred to me, so thanks.  I looked and didn't find 
anything, which is certainly not definitive.

> Possible Solution 3: Also, look into the sender_canonical_maps config option in postfix. It can
> do some sort of outgoing sender address rewriting, but I have no idea how
> granular it is.

I found that in my Postfix book after I sent the OP.  (Duh.)  That or 
maybe aliases actually looks really trivial to do, but they are 

> ------------------------------
> Date: Mon, 01 Mar 2010 18:43:44 -0500
> From: Richard Freeman <>
> I'm not sure if this will work or not, but have you considered:
> 1.  Configure postfix to service mail for
> 2.  Use a mail alias or virtual address to handle the rewrite.
> Only issue I can see is that you're now an open relay for mail going to 
> (for only those addresses defined in alias/virtual).
> ------------------------------
> Date: Tue, 2 Mar 2010 07:36:12 +0100
> From: sean finney <>
> On Mon, Mar 01, 2010 at 06:43:44PM -0500, Richard Freeman wrote:
>> I'm not sure if this will work or not, but have you considered:
>> 1.  Configure postfix to service mail for
>> 2.  Use a mail alias or virtual address to handle the rewrite.
> you should be able to do (2) without needing to do (1).

Yup, I think either of those would work, though a simple alias (2) is 
both easier and more secure than spoofing (1).  But again, they are 

 > it's possible that you could work around the problem with a custom
 > virtual(5) map, but with the description being in such broad
 > strokes, who knows :)

Interesting.  Based on my reading of the man page, that looks like it's 
for incoming mail for users without local machine accounts though.  Did 
I miss something?

I also thought about writing a custom "command based filter" using 
Postfix pipes.  Even though the logic is trivial (if ${sender} == Wife 
&& ${recipient} == Mom_bad; then ${recipient} = Mom_good) the rest of 
the moving parts look like more trouble, performance hit and loss of 
robustness than this is worth.

Then I thought about Postfix header checks.  Redirect *looked* good, but 
sounds like it would break with multiple recipients.  Replace could fix 
the address, but they all only work 1 line at a time, so again it's 
all-or-nothing.  :-(

Thanks for all the thoughts and feedback,
JP Vossen, CISSP            |:::======|
My Account, My Opinions     |=========|
"Microsoft Tax" = the additional hardware & yearly fees for the add-on
software required to protect Windows from its own poorly designed and
implemented self, while the overhead incidentally flattens Moore's Law.
Philadelphia Linux Users Group         --
Announcements -
General Discussion  --