[Mimedefang] Filtering usernames

Kees Theunissen theuniss at rijnh.nl
Fri Dec 15 14:23:18 EST 2006


On Fri, 15 Dec 2006, Kenneth Porter wrote:

> I've got a wildcard entry in my virtusertable to deal with the braindead
> websites that can't handle plussed addresses. I want to be able to put
> "shiva+yourwebsitehere" as my username but most reject that. So I've got a
> mismash of adhoc usernames that either use a dot instead of a plus, or omit my
> username and just use the sitename. (Sometimes the braindeath is a too-short
> email field.)

You can use a few sendmail rewriting rules instead of the wildcard
entry in your virtusertable.

Put something like this at the bottom of your sendmail.mc file and
generate a new sendmail.cf Be aware that the LHS and the RHS of the
rules are separated by tabs. Don't replace the tabs with spaces.


LOCAL_RULE_0
# Rewrite shiva.whatever to shiva+whatever
R shiva . $*		$@ shiva + $1
R shiva . $* <@$=w.>	$@ shiva + $1 < @ $2 . >

# If the local.part of an address contains dots then do a
# nameserver lookup to test if the local.part is a valid domain
# name and replace with shiva+local.part if so.
# But don't do a nameserver lookup if the address contains a +
R $* + $*		$@ $1 + $2
R $+ . $-		$: $1.$2 @@ $[ $1.$2 $]
R $+ . $-  <@$=w.>	$1.$2<@$3.> @@ $[ $1.$2 $]
R $* @@ $* .		shiva + $1
R $* @@ $*		$1



This code will do a namesever lookup for every local username
that contains dots. You might not like that if you frequently
use names or aliasses with dots. Mail will be delivered to the
wrong person if a local.part resolves to a valid domain name
for any of your users/aliases.
I wouldn't use this on a mailserver that has many accounts.
But it might be usefull on a personal workstation or a system with
ony a few mail accounts.

Regards,

Kees.

-- 
Kees Theunissen
F.O.M.-Institute for Plasma Physics Rijnhuizen, Nieuwegein, Netherlands
E-mail: theuniss at rijnh.nl,  Tel: (+31|0)306096724,  Fax: (+31|0)306031204




More information about the MIMEDefang mailing list