[Mimedefang] How can I get just the domain from $sender

Joseph Brennan brennan at columbia.edu
Tue Feb 22 11:36:11 EST 2005


> I have to add a disclaimer as an attachment to all outgoing emails on my
> server. I managed to do this but the disclaimer is added to all mail (in
> and out)
>
> I want to be able to add the disclaimer only if the domain = abc.com I
> can get the whole mail address from $sender but I do not know how to use
> perl to strip just the domain from this. Or is there another way?



It depends on your definition of "outgoing".

If you can define it as mail sent from your own IP addresses, maybe
you can define it by testing $RelayAddr.

Testing by the sender address (which is $Sender not $sender) is
not as good, since anyone might send mail with your domain in the
sender address, including spammers and viruses.

Something like this:

if ($RelayAddr =~ /66\.8\.25\./) {
	# add that attachment
}



Joseph Brennan
Academic Technologies Group, Academic Information Systems (AcIS)
Columbia University in the City of New York




More information about the MIMEDefang mailing list