1

Topic: top sender has no outgoing mails logged

==== Required information ====
- iRedMail version: 1.8.2 (You are running version 1.8.2)
- Store mail accounts in which backend (LDAP/MySQL/PGSQL): MySQL
- Linux/BSD distribution name and version: CentOS 6.5
- Related log if you're reporting an issue: /var/log/maillog I guess
====

We've just noted that one of the top senders as noted in the iRedAdmin control panel 'Dashboard' does not have any emails noted when we click on the user's email address.  Received messages appear to display as normal, and the Quarantine tab is empty.

This user is sending 3,000 - 5,000 emails per day.  After some investigation I discovered that these appear to be legitimate, automated emails from the address we host, going to the user's GMail account.  I also found that the header in these automated emails appears to have a malformed header (missing date line I believe):

----
amavis[4737]: (04737-04) Passed BAD-HEADER-7 {RelayedOutbound}, MYUSERS LOCAL [1.2.3.4]:54935 [1.2.3.4] <someuser@somedomain.com> -> <some.user@gmail.com>, Queue-ID: 7E48FC3C58, mail_id: SMvptt7ht9ll, Hits: -8.143, size: 10227, queued_as: 9F830C3C34, 5153 ms
----

I had configured amavis to pass bad header emails because it was blocking too many legitimate emails previously.  I suspect this has something to do with why no emails show up for this top sender.  All of this user's emails are attended by a maillog entry like the above.  How might this be repaired?

----

Spider Email Archiver: On-Premises, lightweight email archiving software developed by iRedMail team. Supports Amazon S3 compatible storage and custom branding.

2

Re: top sender has no outgoing mails logged

A bug in iRedAdmin-Pro, it doesn't list bad-header emails. You can fix it with below patch:

--- libs/amavisd/log.py    2014-05-15 22:13:29.000000000 +0800
+++ libs/amavisd/log.py    2014-07-23 00:07:05.000000000 +0800
@@ -190,7 +190,7 @@
                 LEFT JOIN msgrcpt ON (msgs.mail_id = msgrcpt.mail_id)
                 LEFT JOIN maddr AS sender ON (msgs.sid = sender.id)
                 LEFT JOIN maddr AS recip ON (msgrcpt.rid = recip.id)
-                WHERE msgs.content='C' %s
+                WHERE msgs.content IN ('C', 'H') %s
                 ''' % (sql_append_where)
             )
             total = resultOfCount[0].total or 0
@@ -227,7 +227,7 @@
                 RIGHT JOIN msgrcpt ON (msgs.mail_id = msgrcpt.mail_id)
                 RIGHT JOIN maddr AS sender ON (msgs.sid = sender.id)
                 RIGHT JOIN maddr AS recip ON (msgrcpt.rid = recip.id)
-                WHERE msgs.content='C' %s
+                WHERE msgs.content IN ('C', 'H') %s
                 ''' % (sql_append_where)
             )
             total = resultOfCount[0].total or 0
@@ -375,7 +375,7 @@
                     LEFT JOIN msgrcpt ON (msgs.mail_id = msgrcpt.mail_id)
                     LEFT JOIN maddr AS sender ON (msgs.sid = sender.id)
                     LEFT JOIN maddr AS recip ON (msgrcpt.rid = recip.id)
-                    WHERE msgs.content='C' %s
+                    WHERE msgs.content IN ('C', 'H') %s
                     ORDER BY msgs.time_num DESC
                     LIMIT %d
                     OFFSET %d
@@ -399,7 +399,7 @@
                     RIGHT JOIN msgrcpt ON (msgs.mail_id = msgrcpt.mail_id)
                     RIGHT JOIN maddr AS sender ON (msgs.sid = sender.id)
                     RIGHT JOIN maddr AS recip ON (msgrcpt.rid = recip.id)
-                    WHERE msgs.content='C' %s
+                    WHERE msgs.content IN ('C', 'H') %s
                     ORDER BY msgs.time_num DESC
                     LIMIT %d
                     OFFSET %d

3

Re: top sender has no outgoing mails logged

This appears to have worked perfectly.  Thank you!