Nov
24
2011

Configure sendmail to start logging Subject in maillog

919 views

First of all take backup of your "sendmail.mc" and "sendmail.cf" files. Default location for those files is /etc/mail.
Now open "sendmail.mc" in your favourite editor and add following lines in it and save it. I usually prefere to add it at boottom of file so you can easily identify your modifications.

LOCAL_CONFIG
Klog syslog
HSubject: $>+CheckSubject

LOCAL_RULESETS
SCheckSubject
R$* Press TAB Key $: $(log Subject: $1 $) $1

This last line is very crusial. after R$* press tab key as suggested. Then after $: press space key.
After log there is a space key, after Subject: there is a space key after $1 there is a space key. After closing bracket there is a space key before $1.

Now you need to regenerate sendmail.cf file. use m4 macro to do so.

#m4 sendmail.mc > sendmail.cf

Now restart sendmail and you verify your maillog file. You will see Subject line for each mail which is being sent from or relayed from your email server

นำมาจาก http://www.linux4beginners.info/node/Log-Subject-sendmail-maillog


Written by Pipo in: FreeBSD & Linux |

No Comments »

RSS feed for comments on this post. TrackBack URL

Leave a comment

Page 1 of 11

Powered by WordPress | Aeros Theme | TheBuckmaker.com WordPress Themes