Postfix search mail log

The joys of debugging email issues!

To search the postfix mail log, you can use the postlog command or grep command with the log file path. Here are a few examples:

Using postlog command:

  1. Install the postlog package if you haven't already: sudo apt-get install postlog (on Ubuntu-based systems)
  2. Run the following command to search for a specific message ID: postlog -s <message_id>
  3. Run the following command to search for a specific sender or recipient: postlog -s -s <sender_email> -r <recipient_email>

Using grep command:

  1. Find the log file path: usually located at /var/log/mail.log or /var/log/mail.log.1 (depending on the system and log rotation settings)
  2. Run the following command to search for a specific message ID: grep "message-id: <message_id>" /var/log/mail.log
  3. Run the following command to search for a specific sender or recipient: grep "<sender_email>" /var/log/mail.log or grep "<recipient_email>" /var/log/mail.log

Tips and variations:

Remember to replace <message_id>, <sender_email>, and <recipient_email> with the actual values you're searching for.