[Mimedefang] How can I get just the domain from $sender
Jonathan Maliepaard
jon at enetworks.co.za
Wed Feb 23 03:21:25 EST 2005
Hi
And a big thanks to all of you who offerered so many elegant solutions.
I have noted all of your coments about relaying issues and the merits of
using IP's rather than a domain name etc. As it turns out the server
that I relay off is the same box so I cannot use IP's - or would
localhost work?
As a start I decided on going with what Jim suggested as it suited my
environment the best, and did the following:
I added the following into the sub_filter_end section just before
Spamassassin kicks in.
<SNIP>
sub filter_end ($) {
my($entity) = @_;
# No sense doing any extra work
return if message_rejected();
# Disclaimer below
if($Sender =~ /\@abc\.com>?$/i) {
action_add_part($entity, "text/plain", "-suggest",
"Disclaimer :\n" .
"The information contained in this e-mail message is
privileged and confidential\n" .
"information intended for the intended recipient only.
If you are neither the\n" .
"intended recipient nor the employee or agent
responsible for delivering this\n" .
"message to the intended recipient,you are hereby
notified that any disclosure,\n" .
"copying, distribution or the taking of any action in
reliance on the contents\n" .
"of this e-mail is strictly prohibited. If you have
received this e-mail in error,\n" .
"please reply and notify the sender and delete this
message. Unauthorized\n" .
"interception of this e-mail is a violation of federal
criminal law.\n" .
"Scanned by McAfee Groupshield and ClamAV.\n",
"disclaimer.txt", "inline");
}
</SNIP>
This is now working perfectly, only adding the disclaimer.txt (for whats
its worth) to mails where the sender is part of the abc.com domain. I
now realise that I have a second domain that I need to add the same
disclaimer to. With my limited knowledge I realise I can repeat the
statement above with a different domain, but I would prefer to have a
more elegent solution (in the interests of keeping the mimedefang-filter
file as concise as possible) using some kind of "or" statement as in:
If $Sender = abc.com or efg.com then add disclaimer
Can anyone help me here?
Thanks
Jon.
More information about the MIMEDefang
mailing list