Hi
The simpler solution for me:

sender_dependent_default_transport_maps =
    mysql:/etc/postfix/mysql_sender_default_rotate_map.cf

cat mysql_sender_default_rotate_map.cf

query = select transport from virtual_transport where active='1' order
by rand() limit 1;

+----+-----------------------+--------+
| id | transport             | active |
+----+-----------------------+--------+
|  1 | smtp1                    |      1 |
|  2 | smtp235                |      1 |
|  3 | smtp12                  |      1 |
|  4 | smtp185                |      1 |
|  5 | smtp29                  |      1 |
|  6 | smtp149                |      1 |
|  7 | smtp30                  |      1 |
+----+-----------------------+--------+

and you must set transportname in master.cf and rate (if you need) on
main.cf

On 27.01.2021 18:39, Wietse Venema wrote:
> combro2k combro2k:
>> Hi there,
>>
>> I've been looking for some days for a solution I need to create for a
>> customer.
>> What we want to achieve is throttling the delivery of mails in the queue.
>> Right now we are using 'default_destination_rate_delay = 1s' which allows
>> us to send approx. 3600 to each destination maximum in 1 hour timeframe.
>> But we want to be more specific like 5000 mails globally,or 16000 globally,
>> whatever we want to do.
>> I've looked into PolicyD to achieve this, but I am stuck at the
>> implementation of it at the queue system of Postfix;
>> Right now I can only see it work with the smtpd_recipient_restrictions and
>> smtpd_end_of_data_restrictions configuration option but not with the queue
>> service.
>> Am I missing something or I am overthinking it?
> You can implement sub-second rate delays with parallel deliveries.
> Below is an example from an last-year's email.
>
>       Wietse
>
> In /etc/postfix/master.cf:
>
> smtp1      unix  -       -       n       -       -       smtp
> smtp2      unix  -       -       n       -       -       smtp
> ...
> smtpN      unix  -       -       n       -       -       smtp
>
> In /etc/postfix/main.cf:
>
> smtp1_destination_rate_delay = 1
> smtp2_destination_rate_delay = 1
> ...
> smtpN_destination_rate_delay = 1
>
> transport_maps = 
>     inline:{
>             { $myhostname = $local_transport }
>             { localhost = $local_transport }
>             { localhost.$mydomain = $local_transport }
>             # Other domains that don't deliver over SMTP...
>     }
>     randmap:{ smtp1:, smtp2:, ..., smtpN: }
>
> This syntax requires Postfix 3.0 or later.

--

Reply via email to