1

Topic: Some messages in database are not visible

============ Required information ====
- iRedMail version: 0.8.7
- Stores mail accounts in MySQL
- Web server: Apache
- Debian 7
- in /var/log/iredapd.log i see something like this:
2015-03-13 19:09:52 INFO [11.22.33.44] user@email-somewhere.net -> user@local-domain.info, DUNNO
- in /var/log/dovecot/dovecot-sieve.log are similar records:
Mar 13 19:15:21 lda(postmaster@local-domain.info): Info: msgid=<20150313181521.56F9F29989@mail.local-domain.info>: saved mail to INBOX
====

Hello,
for about 24 hours I had a problem with amavis. Amavis felt down on every attempt to process message. I switched off collaboration between postfix and amavis for this moment and I'm going to solve it later. Now I have more important problem: during the time amavis was broken postfix, according to log records wrote some emails to myqsl database (i suppose), but those messages are not visible through imap or roundcube interfaces. A lot of records similar to one noted above is in logfile. So question is: how I can access those messages and how I can move them to inboxes of appropriate users?

Thanks for hints
Martin Calko

----

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

2

Re: Some messages in database are not visible

*) Please show us related log.
*) Postfix doesn't store message in SQL database, i guess you misunderstood some log.

3

Re: Some messages in database are not visible

ZhangHuangbin wrote:

*) Please show us related log.
*) Postfix doesn't store message in SQL database, i guess you misunderstood some log.

Which log do you exactly mean?

If postfix does not store messages in database, where are those written to? Especially in case amavis is configured?

4

Re: Some messages in database are not visible

Postfix doesn't store e-mails. It delivers them, either to the remote server, or locally to dovecot. Dovecot then stores them in the mailboxes, by default /var/vmail/vmail/[domain]/[several subfolders]

5

Re: Some messages in database are not visible

cmartin wrote:

Now I have more important problem: during the time amavis was broken postfix, according to log records wrote some emails to myqsl database (i suppose), but those messages are not visible through imap or roundcube interfaces.

What log makes you think the mail was stored in SQL database?

If you have Amavisd enabled (and working), it may quarantine detected spam into SQL database. Did you configure Amavisd to quarantine spam by following our tutorial below?
http://www.iredmail.org/docs/quarantining.html

6

Re: Some messages in database are not visible

ZhangHuangbin wrote:
cmartin wrote:

Now I have more important problem: during the time amavis was broken postfix, according to log records wrote some emails to myqsl database (i suppose), but those messages are not visible through imap or roundcube interfaces.

What log makes you think the mail was stored in SQL database?

I have no valid reason to believe that iredmail stores messages in database. I thought that it do because mysql was configured during installation and I really don't know for which particular purpose. Maybe database has good effectivity for text data indexing, fulltext search or so. As 7t3chguy explained above dovecot stores messages in filesystem.

According to logs: I have only logfiles noted at the beginnig of first message. Server had not installed standard syslog daemon at the time of incident, so I have no /var/log/mail.log records from this time. Yes, I installed it immediately, but for forensic purposes - too late.

ZhangHuangbin wrote:

If you have Amavisd enabled (and working), it may quarantine detected spam into SQL database. Did you configure Amavisd to quarantine spam by following our tutorial below?
http://www.iredmail.org/docs/quarantining.html

According to configuration fragment below, I think that quarrateeing was not enabled.
---
# Don't quarantine mails with bad header.
$bad_header_quarantine_method = undef;

# Quarantine SPAM.
# Where to store quarantined mail message:
#   - 'local:spam-%i-%m', quarantine mail on local file system.
#   - 'sql:', quarantine mail in SQL server specified in @storage_sql_dsn.
#   - undef, do not quarantine mail.
$spam_quarantine_method = undef;
#$spam_quarantine_method = 'sql:';
#$spam_quarantine_to = 'spam-quarantine';

#########################
# Quarantine VIRUS mails.
#
#$virus_quarantine_to     = 'virus-quarantine';
#$virus_quarantine_method = 'sql:';

#########################
# Quarantine BANNED mails.
#
$banned_files_quarantine_method = undef;
# Or quarantine banned mail to SQL server.
#$banned_files_quarantine_method = 'sql:';
#$banned_quarantine_to = 'banned-quarantine';

#########################
# Quarantine CLEAN mails.
# Don't forget to enable clean quarantine in policy bank 'MYUSERS'.
#
# = 'sql:';
# = 'clean-quarantine';
---

7

Re: Some messages in database are not visible

cmartin wrote:

Mar 13 19:15:21 lda(postmaster@local-domain.info): Info: msgid=<20150313181521.56F9F29989@mail.local-domain.info>: saved mail to INBOX

This log means email was delivered to postmaster@local-domain.info's mailbox, in INBOX folder. Not stored in sql database.
If you cannot see this mail in mailbox, please try to turn on debug mode in Dovecot and send a testing email again, check Dovecot log file to see what the problem is.

Reference:
http://www.iredmail.org/docs/debug.dovecot.html