summaryrefslogtreecommitdiff
path: root/localshowmailreceived
blob: 3d8fe193d7cc2a0bd4f30aa2669f5e10468b2dc1 (plain)
  1. #!/bin/sh
  2. #
  3. # /usr/local/sbin/localshowmailreceived
  4. # Copyright 2007 Jonas Smedegaard <dr@jones.dk>
  5. #
  6. # $Id: localshowmailreceived,v 1.1 2007-09-15 02:06:16 jonas Exp $
  7. #
  8. # List recently received emails
  9. #
  10. # TODO: Handle other indicatiors than AMaViS
  11. #
  12. logfiles=1
  13. find /var/log -name 'mail.log*' | sort -nr -t. -k3 | tail -n "$logfiles" | xargs zcat -f \
  14. | egrep -- ' -> <'"$1"'@homebase.dk>' \
  15. | sed 's/^\(.\{15\}\) [^)]*) \([^,]*\), [^]]*] \([^ ]*\) -> .*Message-ID: \([^>,]*>\?\).*/\1 \3 (\4) \2/'