[Mimedefang] How can I get just the domain from $sender
Damrose, Mark
mdamrose at elgin.edu
Tue Feb 22 11:47:33 EST 2005
> -----Original Message-----
> From: mimedefang-bounces at lists.roaringpenguin.com
> 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?
> I need help with the "message_is_outgoing" definition please
Testing for sender address is probably not the best way to do this. I would
suggest testing for specific IP address(es) that are allowed to send.
Example:
sub message_is_outgoing($) {
my ($RelayIP) = @_;
# Use the next section if outgoing mail
# originates on this server.
if ($RelayIP eq "127.0.0.1") {
return 1;
}
# Use the next section if outgoing mail
# originates from a specific internal server.
if ($RelayIP eq "192.168.1.50") {
return 1;
}
# Use the next section if outgoing mail
# originates from any client on this net.
if ($RelayIP =~ /^192\.168\.2\.") {
return 1;
}
return 0;
}
Call using
if ( message_is_outgoing($RelayAddr) )
More information about the MIMEDefang
mailing list