Discussion:
[Mimedefang] Block internal messages
Marcelo Machado
2016-12-26 21:35:06 UTC
Permalink
Hi everyone.

I am new to Mimedefang and I would like to know if it is possible to
block internal messages, (from my domain to my domain) if the number
of recipients is greater than 10.

Marcelo Gomes
_______________________________________________
NOTE: If there is a disclaimer or other legal boilerplate in the above
message, it is NULL AND VOID. You may ignore it.

Visit http://www.mimedefang.org and http://www.roaringpenguin.com
MIMEDefang mailing list ***@lists.roaringpenguin.com
http://lists.roa
Richard Laager
2016-12-27 02:38:54 UTC
Permalink
Post by Marcelo Machado
I am new to Mimedefang and I would like to know if it is possible to
block internal messages, (from my domain to my domain) if the number
of recipients is greater than 10.
Anything is possible if you write the custom Perl code required. What
you have described wouldn't be too terribly hard. No, that's not an
offer to write it. Look at the @Recipients array. In there, you can
determine if some recipients are local, and how many. The $Sender
variable is how you'd determine if the sender is local.
--
Richard
_______________________________________________
NOTE: If there is a disclaimer or other legal boilerplate in the above
message, it is NULL AND VOID. You may ignore it.

Visit http://www.mimedefang.org and http://www.roaringpenguin.com
MIMEDefang mailing list ***@lists.roaringpenguin.com
http://lists.roaringpenguin.com/mailman/listinfo/
Kevin A. McGrail
2016-12-27 03:01:46 UTC
Permalink
Post by Richard Laager
Post by Marcelo Machado
I am new to Mimedefang and I would like to know if it is possible to
block internal messages, (from my domain to my domain) if the number
of recipients is greater than 10.
Anything is possible if you write the custom Perl code required. What
you have described wouldn't be too terribly hard. No, that's not an
determine if some recipients are local, and how many. The $Sender
variable is how you'd determine if the sender is local.
filter_sender might be the better way to go. That way you can
accept/reject/etc.

From the man page:

filter_sender is passed four arguments: $sender is the envelope
e-mail address of the sender (for example,
"<***@roaringpenguin.com>"). The address may or may not be
surrounded by angle brackets. $ip and $name are
the IP address and host name of the SMTP relay. Finally, $helo
is the argument to the SMTP "HELO" command.

Then something to strip to the domain:

#get domain name from an email address
sub get_domain_from_email {
my ($domain) = @_;

#REMOVE ANY LEADING/TRAILING <>'s
$domain =~ s/(^<|>$)//g;
#REMOVE ANY LEADING/TRAILING SPACE'S
$domain =~ s/^ *//g;
$domain =~ s/ *$//g;
#REMOVE EVERYTHING UP TO THE @ SYMBOL
$domain =~ s/.*\@//g;

return $domain;
}

And then a check like if (uc(&get_domain_from_email($sender)) eq
'MARCELO.ORG') {

return ('REJECT', "Sorry; Can't send internal email.");
}

Regards,
KAM
_______________________________________________
NOTE: If there is a disclaimer or other legal boilerplate in the above
message, it is NULL AND VOID. You may ignore it.

Visit http://www.mimedefang.org and http://www.roaringpenguin.com
MIMEDefang mailing list ***@lists.roaringpenguin.com
http://lists.roaringpenguin.com/ma

Loading...