Hi all,
We need a way to limit outbound mails to a specific domain to just 10 mails in 
10minutes. The issue I’m having is that I can only get it to send 1 email every 
queue run, so 1 email every 10minutes. I can set the destionation_rate_delay to 
1minute, and have 10 of them send in 10minutes, but this delays the messages 
for up to 10 minutes.

I have a custom smtp_transport configured in a test environment:

Running postfix 2.6.6
CentOS 6.8 x64

Main.cf
#ratelimit config
smtp-dave_destination_rate_delay = 30s
smtp-dave_destination_concurrency_limit = 1
smtp-dave_destination_recipient_limit = 2
smtp-dave_initial_destination_concurrency = 1

#transport map
transport_maps = regexp:/etc/postfix/transport

In /etc/postfix/transport I have:
/\@domain\.co\.uk/          smtp-dave:
(where domain is the receiving domain that this needs to apply to)

Master.cf
smtp-dave unix  -       -       n       -       1       smtp
-o syslog_name=smtp-dave

-----------------------------

I trigger a bunch of emails to be sent instantly with the following:
for i in `cat recpts`; do echo "hello" | mail -s "testing throttling" $i; done
(where recpts is a file with 60instances of the receiving domains email address)

What happens taking the above config into account is it queues 59 mails, sends 
one, then runs the transport every 30seconds, and sends 1 more mail, waits 
30seconds, sends 1 more mail.

There are two problems with this:

Firstly, if I change the config to:
smtp-dave_destination_rate_delay = 30s
smtp-dave_destination_concurrency_limit = 5
smtp-dave_destination_recipient_limit = 2
smtp-dave_initial_destination_concurrency = 5

It does not send 5 emails at once, which I expected it to.. Perhaps I’ve 
misinterpreted the meaning od concurrency limit?

Also, I really only want the first 10 mails to be sent, I don’t care about the 
others at this point. If it is sending that many, I do not want to hear about 
the others, they can be deleted. How can I achieve this with postfix alone?

To give some context, the mails are outbound, destined for an email to SMS 
service. The SMS’s are critical alerts for some of our infrastructure. In 
certain events, we get spammed with SMS’s and charged a great deal of money by 
the service provider for this. I’d like to limit it to say 10 in 10mins, if I 
get that many of them, I’ll know theres an issue and wont need SMS’s for the 
remainder of them.

Thanks.


Best Regards,
Dave Byrne
Head of Technical Projects
Office: 01622 524 200
The Maidstone Studios | Vinters Business Park | New Cut Road | Maidstone | Kent 
| ME14 5NZ

This communication and any attachments contain information which is 
confidential and may also be privileged. It is for the exclusive use of the 
intended recipient(s). If you are not the intended recipient(s) please note 
that any form of disclosure, distribution, copying or use of this communication 
or the information in it or in any attachments is strictly prohibited and may 
be unlawful. If you have received this communication in error, please return it 
with the title 'received in error' to david.by...@vooservers.com then delete 
the email and destroy any copies of it. Email communications cannot be 
guaranteed to be secure or error free, as information could be intercepted, 
corrupted, amended, lost, destroyed, arrive late or incomplete, or contain 
viruses. We do not accept liability for any such matters or their consequences. 
Anyone who communicates with us by email is taken to accept the risks in doing 
so. Opinions, conclusions and other information in this email and any 
attachments which do not relate to VooServers are neither given nor endorsed by 
it.


Reply via email to