Fluent::Programmer

    Home Blog About
  • Home
  • Blog
  • About

How to enable subject information to be logged in postfix mail server logs? πŸ‘‹

  • Fluent Programmer
  •   1 min read

Quick summary ↬  Enabling subject information in log storage will help administrators to sort the mails send based on the subject using grep command. In this micro article, we explain a quick 4 steps to enable this.

Introduction

I hope you have a working Postfix mail server and just want to see the subject line in the logs. By default postfix enables the β€˜from’ and β€˜to’ email addresses to be logged but it is possible to capture many useful information in the logs to help administrators or marketing campaign specialists to monitor it in real-time.

Step 1

Edit '/etc/postfix/main.cf' file with the editor of your choice and add the line header_checks = regexp:/etc/postfix/header_checks.

Don’t forget to save it.

Step 2

Append the line /^Subject:/ WARN in the file /etc/postfix/header_checks

Step 3

Now it’s time to run postmap postmap /etc/postfix/header_checks

Step 4

Restart the postfix server using the command: postfix reload

Now monitor the flow of subject included in the logs using tail -f /var/log/mail.log

About The Author

Fluentprogrammer doesn't need coffee to program. They run on pure caffeine and lines of code.

Email Newsletter

Table of Contents

  • Introduction
  • Step 1
  • Step 2
  • Step 3
  • Step 4
  • C++
  • Beautiful code series

Unhealthy love with dark corners of C++

Founded by an engineer to help engineers. 2021–2023.

  • About us
  • Privacy policy