Sendmail: Clear / Delete / Flush Mail Queue Command

www.laut‮irut‬.com
Sendmail: Clear / Delete / Flush Mail Queue Command

To clear, delete, or flush the mail queue in Sendmail, you can use the sendmail -q command.

This command tells Sendmail to process the mail queue, which includes delivering any undelivered mail and removing any mail that has been successfully delivered or has expired.

By default, the sendmail -q command processes the mail queue every hour, but you can use the -qI option to specify a different interval. For example, to process the mail queue every 15 minutes, you can use the following command:

sendmail -qI 15m

You can also use the -qR option to specify a specific delivery agent or mailer to use when processing the queue. For example, to process the mail queue using the local delivery agent, you can use the following command:

sendmail -qR local

Keep in mind that the sendmail -q command only processes the mail queue and does not delete or remove any mail from the queue. To delete or remove mail from the queue, you can use the sendmail -qG command, which removes all mail from the queue that has been in the queue for more than a specified number of days.

For example, to delete all mail from the queue that has been in the queue for more than 7 days, you can use the following command:

sendmail -qG7d

This will delete all mail from the queue that has been in the queue for more than 7 days.

You can also use the sendmail -bp command to view the contents of the mail queue, and the sendmail -qX command to delete a specific message from the queue. For more information about these and other Sendmail commands, you can consult the Sendmail documentation or use the man sendmail command to see the manual page.

Created Time:2017-10-30 14:27:18  Author:lautturi