incoming with the /go/incoming Command

/go/incoming reads today's entries in the Postfix mail log, /var/log/maillog, and builds a table of the messages the server's SMTP service accepted. For each message it shows: The table is printed on screen and saved to /var/log/go/mail/incoming/incoming-YYYY-MM-DD.log. Every admin action in GoAdmio has a matching /go/ command, so anything you can click you can also script.

Quick start

# List today's received messages
/go/incoming

Examples

# Run the report
/go/incoming

# Show today's saved report again without rebuilding it
column -t -s "|" /var/log/go/mail/incoming/incoming-$(date +%F).log

# Count today's messages
tail -n +3 /var/log/go/mail/incoming/incoming-$(date +%F).log | wc -l

# Rank today's sender IP addresses
tail -n +3 /var/log/go/mail/incoming/incoming-$(date +%F).log | cut -d'|' -f4 | sort | uniq -c | sort -nr | head

# Find mail for one recipient
grep -i 'sales@mydomain.com' /var/log/go/mail/incoming/incoming-$(date +%F).log

# Check which mail log your server uses
ls -l /var/log/maillog /var/log/mail.log

# Delete reports older than 30 days (the command never deletes them)
find /var/log/go/mail/incoming -name 'incoming-*.log' -mtime +30 -delete

Output

Time From To IP Subject
---- ---- -- -- -------
12:01:07 news@example.org info@mydomain.com 203.0.113.5 Weekly newsletter
12:03:42 jo@example.net sales@mydomain.com 198.51.100.9 Quote request

Outcome What you get
Messages found One row per message, in the order they were first logged.
Nothing matched Only the two header lines.

The command always exits with status 0. Check the table to see whether it found anything.

See the full reference at /go/incoming and the GoAdmio command index.

GoAdmio is free and open source, with no license fees and no account limits. Read the GoAdmio docs, or see why it is a free cPanel alternative at goadmio.com.

By:

Posted in:


Leave a Reply

Your email address will not be published. Required fields are marked *