Re: Block internal messages

"Kevin A. McGrail" <[email protected]>
Newsgroups gmane.mail.mimedefang
Message-ID <[email protected]>
On 12/26/2016 9:38 PM, Richard Laager wrote:
> On 12/26/2016 03:35 PM, Marcelo Machado wrote:
>> 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.
>

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,
        "<[email protected]>").   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 [email protected]
http://lists.roaringpenguin.com/mailman/listinfo/mimedefang
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.