I have a backup mail server in case of a failure on the main one. In that case of failure, mails come on the backup server and stay there until the main one is back.
If I wait some times, the delivery will be done automatically as soon as the main server is back but it can be long. So how to force a send retry of all the mails?
For exemple : postqueue -p : give me a list of mails
I then tried postqueue -f (from man page : Flush the queue: attempt to deliver all queued mail.). It surely flushed the queue but mails were not been delivered...
According to postqueue(1) you can simply run
postqueue -f
to flush your mail queue. If the mails aren't delivered after flushing the queue but are being requeued instead, you might want to check your mail logs for errors.Taking a peek at postsuper(1) might also be helpful. Maybe the messages are on hold and need to be released first.
postqueue -f
should work. If it does not, it has a good reason for that. Check the logs. Also pfqueue is a very useful command for inspecting mail spool.sendmail -q
retries delivery of all mails in the queue immediately.I'm usually using this command
Parameters:
-r ALL
is requeue all message-f
is Flush the queue: attempt to deliver all queued mail.postqueue -s domain.tld
should cause the backup relay machine to flush all the email for your site. The default setup for postfix enables per-site flushing for all domains inrelay_domains
.postqueue -f
will do this too, but will also push out mail for external sites, i.e. it does more than you need.How are you determining that mail has not been delivered? Are they still on the backup host or have they been sent to the main host and then got lost?