Routing the world

Routing & IT System Administration

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

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s

%d bloggers like this: