If you are using postfix, there is a mechanism explained here, which I
havent tried.
Reconfigure postfix by copying /etc/postfix/main.cf and adding lines:
defer_transports = hold
default_transport = hold
Beware, you may already have a default_transport. Swap your new file with the real main.cf and
restart postfix and send your mails. They will be placed in the hold queue.
To release the queue, restore the real main.cf, restart postfix and force the queue to release with
sudo service postfix restart
sudo mailq -q
Instead of the above, you can hold mail with a given header, for example
if your mail program lets you add X- style headers, or if you want to match
on a given Subject: junk of the day header string.
Check that your postfix implements the regexp feature:
postconf -m|egrep 'regexp|pcre'
should output at least regexp. Create the file /etc/postfix/header_checks and place in it the
regexp pattern of the header you want to match, followed by HOLD, eg:
/Subject: *junk of the day/ HOLD
Add the name of this map file to /etc/postfix/main.cf:
header_checks = regexp:/etc/postfix/header_checks
and restart postfix. Send a suitable mail and check with mailq
that it is in the hold queue (a ! shows next to the queue id.
To release and send all held mails:
sudo postsuper -H ALL
sendmail -q