Getting stats about deliverability from postfix

At work, our CEO is working on a plan to move away from a service provider who do our Spam filtering, etc.

Currently, all our mail gets relayed out through this service, and all incoming email gets relayed to us from this service.

Part of the reason this was setup was due to "Deliverability" - a big email service provider like the ones we use is unlikely to be Blacklisted (we had a problem before we moved to them where certain ISPs would block us for sending too many emails to their client (which are just order confirmation/dispatch emails!))

If we were to move away, our mailservers would be delivering directly. I'd like to set up some sort of monitoring system that gives us stats about how many mails we're sending out, what domains we're sending them to, bounce rates, servers that are regularly bouncing us, etc.

Does anyone know of a good solution for this?


Solution 1:

I have been using pflogsumm for about 5 or 6 years. It should be readily available via apt-get or yum.

Normally, I'll check the report at least once a week just to make sure the numbers look normal, but there's really not much more to it. Some useful sections:

Report based on information in /var/log/maillog
Postfix log summaries for Aug  6

Grand Totals
------------
messages

  83401   received
  85066   delivered
    113   forwarded
   3837   deferred  (20601  deferrals)
   2075   bounced
      2   rejected (0%)
      0   reject warnings
      0   held
      0   discarded (0%)

   1667m  bytes received
   1666m  bytes delivered
    324   senders
    103   sending hosts/domains
  19822   recipients
   3273   recipient hosts/domains

and useful for monitoring delivery delay time and number of defers (which will be your first indication that you're being blacklisted):

Host/Domain Summary: Message Delivery (top 10)
 sent cnt  bytes   defers   avg dly max dly host/domain
 -------- -------  -------  ------- ------- -----------
  34164     1344m       0     0.1 s    1.0 s  xxxxxxxx.com
  10332    67337k      48    17.5 s    2.1 h  yahoo.com
   8023    49019k       1     0.9 s   22.3 m  gmail.com
   5618    36421k       0     0.6 s   13.0 s  hotmail.com
   4933    34041k       0     0.3 s   10.0 s  aol.com
   4049    23887k       0     0.0 s    1.0 s  cfmailtest.xxxxxxx
   1670    10819k       0     1.1 s   34.0 s  comcast.net
   1211     7266k       0     0.6 s    7.0 s  msn.com
    827     5540k       0     2.5 s   51.0 s  sbcglobal.net
    685     5415k      21    48.1 s    1.4 h  verizon.net

Solution 2:

There are a number of ways to accomplish this, usually through log file digests. You can find a small list at the postfix site that might point you in the right direction.

If you have logwatch installed, you can add to its functionality and get stats that way too.

logwatch --service postfix --mailto [email protected]

If you need "pretty graphs", you can start with mailgraph, which collects and graphs postfix activity over time.