How to calculate IMAP dovecot bandwidth:
less /var/log/maillog |grep Aug |grep DOMAIN.COM |grep -Po 'out\=.+?,' |cut -d '=' -f2 |tr -d ,|awk '{s+=$1} END {print "total: ", s, " bytes transferred over IMAP"}'
total: 83107245783 bytes transferred over IMAP
echo "83107245783/1024/1024" |bc 79257M ~80G
How to calculate POP3 dovecot bandwidth:
less /var/log/maillog |grep DOMAIN.COM |grep -Po 'retr\=[1-9].?\/[1-9].+?[0-9],' |cut -d/ -f2 |tr -d ,|awk '{t += $1} END { print "total: ", t, " bytes transferred over POP3"}'
total: 92334491 bytes transferred over POP3