Routing the world

Routing & IT System Administration

Archive for December 2009

How to expand mail path in sendmail using the from or to address

leave a comment »

Some times you need to see information about a mail path in the sendmail logs (maillog) and you need to get the Message ID from a from or to seach and then make another cat to see all the sendmail information about this message ID.

There is a way to do it in one line:

for i in `cat /var/log/maillog | grep "from=<USERNAME" | awk '{print $6}' | sed s/://`; do echo $i ; cat /var/log/maillog | grep $i ; done

Where USERNAME is the email account that will appears in the from or to fields.



Written by Root

December 9, 2009 at 15:40

Posted in Linux

Tagged with

%d bloggers like this: