Handling outgoing mass mail
Suppose you manage an outgoing relay which delivers ordinary business email and mass marketing mail at the same time. You'd want to set different delivery policies for these email.Display domain statistics
First, determine which domains are being deferred. In this case, my email going to yah00 are deferred all the time. It's also confirmed from maillog that yah00 is rejecting my mass mail:$ qshape incoming active deferred | head -30 T 5 10 20 40 80 160 320 640 1280 1280+ TOTAL 12502 0 0 0 1 0 20 9632 1412 451 986 yahoo.com.hk 6533 0 0 0 0 0 0 5876 657 0 0 yahoo.com 1472 0 0 0 0 0 0 1300 172 0 0
Setup a dedicated transport for yah00
Ref: http://linuxnet.ca/postfix/dedicated_transport.htmlEdit transport, setup a separate target for certain domain. Run postmap transport to generate a new hash
yahoo.com.hk massmail: yahoo.com massmail:
Edit main.cf, setup a lower concurrency and longer rate_delay for this new transport target
# default concurrency default_process_limit = 501 default_destination_concurrency_limit = 101 smtp_destination_concurrency_limit = 101 transport_destination_concurrency_limit = 101 initial_destination_concurrency = 20 destination_concurrency_feedback_debug = yes #massmail concurrency massmail_destination_concurrency_failed_cohort_limit = 100 massmail_destination_concurrency_limit = 20 # implies concurrency=1 !! # massmail_destination_rate_delay = 3s
In master.cf, define a new service with fewer maxproc. This also requires one to add "massmail" to /etc/services
# ========================================================================== # service type private unpriv chroot wakeup maxproc command + args # (yes) (yes) (yes) (never) (100) # ========================================================================== massmail unix - - n - 20 smtp
Reload postfix.
Holding mass mail and release them after business hours
This requires knowledge of the sender of the mass mail. In this example, the sender is noreply@domain.tldEdit main.cf
smtpd_recipient_restrictions = reject_invalid_hostname, reject_unauth_pipelining, check_sender_access hash:/etc/postfix/sender_access, permit_mynetworks, reject
Edit sender_access, run postmap sender_access to generate the hash
noreply@domain.tld HOLD
Now whenever this sender sends mail into my MTA, it's placed in the HOLD queue. To release these mail after 21:00, edit crontab, and process the messages in the hold queue
# release junk mail after business hours 1 21 * * * /usr/sbin/postsuper -H ALL
There are no comments on this page. [Add comment]