1

I am running some scans on my server tonight and would like to disable email notifications since there is a chance for a LOT of them to be sent out.

I am planning to issue

service postfix stop

while the web scan occurs.

If postfix is stopped, will mail messages go into a queue and be sent when the service is started again? If so, is there a way to easily nuke any queued messages? The messages would be triggered through php's mail function, which ordinarily hands off to postfix.

1

The PHP mail function will invoke the sendmail binary to send a message. So there is not a need for the postfix daemon to be running.

Sendmail will place the email in the maildrop queue. When postfix starts running, the pickup daemon will pick the message and send it. When postfix isn't running, emails stay in maildrop queue forever until they are picked up when postfix runs again.

Resources: Postfix Architecture Overview

Local submissions are received with the Postfix sendmail(1) compatibility command, and are queued in the maildrop queue by the privileged postdrop(1) command. This arrangement even works while the Postfix mail system is not running. The local pickup(8) server picks up local submissions, enforces some sanity checks to protect Postfix, and gives the sender, recipients and message content to the cleanup(8) server.

If so, is there a way to easily nuke any queued messages

Yes. Because the email is stored in maildrop queue, you can run postsuper -d ALL maildrop to nuke all of them. See man 1 postsuper.

# postsuper -d ALL maildrop
postsuper: Deleted: 1 message
| improve this answer | |
  • What file or directory are queued messages stored in? I might want to review some of these prior to nuking all of them. – a coder Dec 23 '14 at 13:08
  • See the output of postconf queue_directory – masegaloeh Dec 23 '14 at 14:19

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.