POSTFIX CHEAT SHEET TERMINAL COMMANDS

Postfix is a popular open-source mail transfer agent that we use for routing and delivering email messages. It is a powerful tool that allows you to configure and manage email servers on Linux and Unix systems. However, working with Postfix requires familiarity with a number of command line tools and utilities. In this post, we will provide you with a cheat sheet of the most commonly used Postfix terminal commands so lets get stared.

POSTFIX CHEAT SHEET TERMINAL COMMANDS

  1. postfix start This command starts the Postfix daemon.
  2. postfix stop This command stops the Postfix daemon.
  3. postfix reload This command reloads the Postfix configuration file without stopping the daemon.
  4. postfix flush This command forces Postfix to flush its mail queue and deliver any queued messages immediately.
  5. postfix status This command displays the current status of the Postfix daemon.
  6. postconf -n This command displays the current Postfix configuration settings.
  7. postmap <file> This command creates or updates a Postfix lookup table file.
  8. postqueue -p This command displays the contents of the Postfix mail queue.
  9. postsuper -d <queue_id> This command deletes a specific message from the Postfix queue.
  10. postsuper -d ALL This command deletes all messages from the Postfix queue.
  11. mailq This command is used to display the number of messages in the Postfix queue.
  12. postcat -q <queue_id> This command displays the contents of a specific message in the Postfix queue.
  13. postfix check This command checks the syntax of the Postfix configuration file for errors.
  14. postfix set-permissions This command sets the correct file permissions on the Postfix configuration files.
  15. postkick <queue_id> This command causes Postfix to reprocess a message in the queue.

These are some of the most commonly used Postfix terminal commands. Familiarizing yourself with these commands will make it easier for you to manage and troubleshoot your Postfix email server. If you need more information about any of these commands, you can consult the Postfix documentation or use the command’s manual page (man <command>).

Delete Email Messages

This will delete ALL emails in the queue.

postsuper -d ALL

To delete all email in the queue from a certain domain, run this command. You will have to be logged in as root.

Only cool people share!

postqueue -p | tail -n +2 | awk 'BEGIN { RS = "" } /@example\.com/ { print 1 }' | tr -d '*!' | postsuper -d -

If you want to delete emails from a specific email address, run this command. Make sure you are logged in as root.

postqueue -p | tail -n +2 | awk 'BEGIN { RS = "" } /username@example\.com/ { print 1 }' | tr -d '*!' | postsuper -d -

To delete a single message:

postuper -d 070788B31

Check Email Queue

postqueue -p

Flash or resend the queue mails

postqueue -f

Check the basic config of Postfix

postconf -n

Check Whole config of Postfix

postconf-n

Renew queue in Postfix

postsuper -r ALL

Reload the configuration after modification to my main.cf or master.cf.

postfix reload
service postfix restart

Check what is going on in /var/log/mail.log

tail -f /var/log/mail.log

To put an email message on hold, use this command after you get the ID number.

postsuper -h 070788B31

Hold Email Messages

To put on hold all Email messages

postsuper -h ALL

To put on hold messages from user@example.com:

postqueue -p | awk ‘BEGIN { RS = “” } { if (7 == “user@domain.com” ) print 1 }’ | tr -d ‘!*’ | postsuper -h –

Release emails from hold

Release single email message:

postsuper -H 070788B31

Release all email messages:

postsuper -H ALL

To release messages just from user@domain.com

postqueue -p | awk ‘BEGIN { RS = “” } { if (7 == “user@domain.com” ) print 1 }’ | tr -d ‘!*’ | postsuper -H –

POSTFIX CHEAT SHEET TERMINAL COMMANDS was last modified: March 16th, 2023 by Maximus Mccullough
Summary
POSTFIX CHEAT SHEET TERMINAL COMMANDS
Article Name
POSTFIX CHEAT SHEET TERMINAL COMMANDS
Description
A list of commands in Linux terminal to edit POSTFIX email settings.
Author
Publisher
A1WEBSITEPRO LLC
Logo
POSTFIX-CHEAT-SHEET-TERMINAL-COMMANDS

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.