I found this on the net when looking up the same thing. I didnt come up with this, but it'll get your CentOS5 box logging subjects in /var/log/maillog.
I added this to the end of my sendmail.mc:
LOCAL_CONFIG
Klog syslog
HSubject: $>+CheckSubject
LOCAL_RULESETS
SCheckSubject
R$* $: $(log Subject: $1 $) $1
*****after R$* in the last line that MUST be a tab******
Run m4 and generate a new cf file and restart:
m4 sendmail.mc > sendmail.cf
/etc/init.d/sendmail restart
My logs now show this:
Dec 5 19:09:42 site sendmail[23327]: qB609gWD023327: from=apache, size=1728, class=0, nrcpts=1, msgid=<[email protected]>, relay=apache@localhost
Dec 5 19:09:42 site sendmail[23328]: qB609gK9023328: Subject: Test1234
Dec 5 19:09:42 site sendmail[23328]: qB609gK9023328: from=<[email protected]>, size=1953, class=0, nrcpts=1, msgid=<[email protected]>, proto=ESMTP, daemon=MTA, relay=myhost.edu [127.0.0.1]
I wish it didnt log the subject on a seperate line, but it does allow you to track emails by subject.