[Techtalk] `TO:' header alias rewrite - Sendmail
Kai MacTane
kmactane at GothPunk.com
Sat Mar 30 11:57:03 EST 2002
At 3/29/02 05:00 PM , Nosferatu!!! wrote:
>Say I have the following alias definition in /etc/aliases -
>ruby: rubidium at hotmail.com
>
>Now, sendmail expands the "ruby" to the proper address in "RCPT TO:",
>but, the "To:" header in the message still reads "To: ruby".
>
>Its not a big deal for me except that "ruby" has Hotmail filtering
>on that rejects messages whose "To:" header does not read as
>"To: rubidium at hotmail.com"
I don't know a whole lot about Sendmail. My only suggestion is: you could
redirect the alias to a program that does the header rewriting and then
re-sends the mail to the destination. So in /etc/alias:
ruby: |/path/to/header-rewrite rubidium at hotmail.com
header-rewrite would then need to take in the mail message on STDIN, get
the destination email address from the first argument ($ARGV[0] in Perl),
replace whatever was in To: with said first argument*, and re-send the mail.
Looks to me like about 100 - 200 lines of Perl.
* Note that you may wish to have it only substitute the argument
contents in for whatever's between any < and > in the To: line.
>Also, I want it to work this way only for selective aliases and not
>for ones like
>
>buddies: aaa at hotmail.com, bbb at yahoo.com, ccc at rediffmail.com
This script could just as easily be designed to get a list of source and
destination addresses from some config file, but making it take the
destination on the command line means that all you need to do is make
changes in /etc/aliases. This keeps /etc/aliases nice and readable without
reference to other files.
In particular, the buddies alias isn't affected.
>I know I'll have to write rulesets for that, but, I don't have
>access to the Bat book. Anybody feeling suicidal? ;)
Maybe that's why my initial thought is "a Perl script can fix this". I
don't have access to the Bat book, and I'm not feeling suicidal. :)
--Kai MacTane
----------------------------------------------------------------------
"Why can't I live a life for me?
Why should I take the abuse that's served?
Why can't they see they're just like me?
I'm not the one that's so absurd!"
--Ministry,
"Every Day is
Halloween"
More information about the Techtalk
mailing list