Linux – Delayed email, server side using dovecot/postfix

email-serverlinuxpostfix

Alternative title: How to delay a mail queue in postfix for a certain user.

I am planning to build a solution. At first it would be I would create a separate email address for queuing. Use a client to send the email from that address. The queue on that email would be paused (not processing) and then create a job/script or something(separate question) to relay a sendmail -q to postfix to release the queue.

How do I make the queue stay in a delayed state so this is possible. I do not wish to stop the service and restart it at certain times since that would disable all other email.

Best Answer

You could instruct postfix via header_checks to hold emails with specific subjects or headers and then have a cron job that would release those emails at specific intervals/time.

So you would put this in your postfix configuration:

header_checks = regexp:/etc/postfix/header_checks 

and then create the header_checks file an put:

/^From: "snailmail/ HOLD

then a cronjob would have to scan the mails that are on hold and release them.