{"id":6160,"date":"2015-04-08T14:29:09","date_gmt":"2015-04-08T06:29:09","guid":{"rendered":"https:\/\/webhostinggeeks.com\/howto\/?p=6160"},"modified":"2023-04-28T09:47:15","modified_gmt":"2023-04-28T09:47:15","slug":"how-to-enable-logging-for-email-subject-fields-in-postfix-maillog","status":"publish","type":"post","link":"https:\/\/webhostinggeeks.com\/howto\/how-to-enable-logging-for-email-subject-fields-in-postfix-maillog\/","title":{"rendered":"How to Enable Logging for Email Subject Fields in Postfix Maillog"},"content":{"rendered":"<p>Postfix MTA basically just capture &#8216;From&#8217; and &#8216;To&#8217; field while the subject is not logged to the maillog. There are simple steps to enable logging of the e &#8211; mail subject in postfix maillog. This will very useful for email administrators when performing troubleshooting of problems related with email.<\/p>\n<h5>1. Assume that postfix has been installed. Open the postfix main configuration file :<\/h5>\n<pre># vi \/etc\/postfix\/main.cf\n<\/pre>\n<h5>2. Uncomment the following :<\/h5>\n<pre>..\n..\nheader_checks = regexp:\/etc\/postfix\/header_checks\n..\n..\n<\/pre>\n<h5>3. Open \/etc\/postfix\/header_checks file and add the following line at the bottom :<\/h5>\n<pre># vi \/etc\/postfix\/header_checks\n<\/pre>\n<pre>..\n..\n\/^Subject:\/     WARN\n<\/pre>\n<h5>4. Run postmap to apply the new configuration in \/etc\/postfix\/header_checks :<\/h5>\n<pre># postmap \/etc\/postfix\/header_checks :\n<\/pre>\n<h5>5. Restart or reload postfix configuration :<\/h5>\n<pre># service postfix restart\n<\/pre>\n<p>or<\/p>\n<pre># postfix reload\n<\/pre>\n<h5>6. Test send email with subject:test-ABC :<\/h5>\n<pre># telnet localhost 25\nTrying ::1...\nConnected to localhost.\nEscape character is '^]'.\n220 centos66.ehowstuff.local ESMTP Postfix\nehlo abc.com\n250-centos66.ehowstuff.local\n250-PIPELINING\n250-SIZE 10240000\n250-VRFY\n250-ETRN\n250-ENHANCEDSTATUSCODES\n250-8BITMIME\n250 DSN\nmail from:admin@ehowstuff.com\n250 2.1.0 Ok\nrcpt to:admin@ehowstuff.com\n250 2.1.5 Ok\ndata\n354 End data with .\nsubject:test-ABC\n.\n250 2.0.0 Ok: queued as 196AD1FDEA\nquit\n221 2.0.0 Bye\nConnection closed by foreign host.\n<\/pre>\n<h5>7. Please confirm that the subject &#8220;test &#8211; ABC&#8221; is appearing in the log :<\/h5>\n<pre># tail -f \/var\/log\/maillog\n<\/pre>\n<pre>Apr  6 23:41:28 centos66 postfix\/smtpd[4919]: connect from localhost[::1]\nApr  6 23:41:58 centos66 postfix\/smtpd[4919]: 196AD1FDEA: client=localhost[::1]\nApr  6 23:42:07 centos66 postfix\/cleanup[4924]: 196AD1FDEA: warning: header subject:test-ABC from localhost[::1]; from= to= proto=ESMTP helo=\nApr  6 23:42:07 centos66 postfix\/cleanup[4924]: 196AD1FDEA: message-id=&lt;20150406154158.196AD1FDEA@centos66.ehowstuff.local&gt;\nApr  6 23:42:07 centos66 postfix\/qmgr[4914]: 196AD1FDEA: from=, size=365, nrcpt=1 (queue active)\nApr  6 23:42:09 centos66 postfix\/smtpd[4919]: disconnect from localhost[::1]\n<\/pre>\n<p><img decoding=\"async\" class=\"alignnone size-full wp-image-6263 lazyload\" data-src=\"https:\/\/webhostinggeeks.com\/howto\/wp-content\/uploads\/2015\/04\/Postfix_logo.png\" alt=\"Postfix_logo\" width=\"545\" height=\"289\" data-srcset=\"https:\/\/webhostinggeeks.com\/howto\/wp-content\/uploads\/2015\/04\/Postfix_logo.png 545w, https:\/\/webhostinggeeks.com\/howto\/wp-content\/uploads\/2015\/04\/Postfix_logo-300x159.png 300w\" data-sizes=\"(max-width: 545px) 100vw, 545px\" src=\"data:image\/svg+xml;base64,PHN2ZyB3aWR0aD0iMSIgaGVpZ2h0PSIxIiB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciPjwvc3ZnPg==\" style=\"--smush-placeholder-width: 545px; --smush-placeholder-aspect-ratio: 545\/289;\" \/><\/p>\n","protected":false},"excerpt":{"rendered":"<p>Postfix MTA basically just capture &#8216;From&#8217; and &#8216;To&#8217; field while the subject is not logged to the maillog. There are simple steps to enable logging of the e &#8211; mail&#8230;<\/p>\n","protected":false},"author":6,"featured_media":6220,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"wds_primary_category":0,"footnotes":""},"categories":[1028],"tags":[1257,1664],"class_list":["post-6160","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-postfix","tag-centos-6-6","tag-postfix"],"_links":{"self":[{"href":"https:\/\/webhostinggeeks.com\/howto\/wp-json\/wp\/v2\/posts\/6160","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/webhostinggeeks.com\/howto\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/webhostinggeeks.com\/howto\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/webhostinggeeks.com\/howto\/wp-json\/wp\/v2\/users\/6"}],"replies":[{"embeddable":true,"href":"https:\/\/webhostinggeeks.com\/howto\/wp-json\/wp\/v2\/comments?post=6160"}],"version-history":[{"count":0,"href":"https:\/\/webhostinggeeks.com\/howto\/wp-json\/wp\/v2\/posts\/6160\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/webhostinggeeks.com\/howto\/wp-json\/wp\/v2\/media\/6220"}],"wp:attachment":[{"href":"https:\/\/webhostinggeeks.com\/howto\/wp-json\/wp\/v2\/media?parent=6160"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/webhostinggeeks.com\/howto\/wp-json\/wp\/v2\/categories?post=6160"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/webhostinggeeks.com\/howto\/wp-json\/wp\/v2\/tags?post=6160"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}