1

Topic: Suspend receiving e-mail

==== Required information ====
- iRedMail version: Pro 1.8.2
- Store mail accounts in which backend (LDAP/MySQL/PGSQL): MySQL
- Linux/BSD distribution name and version: FreeBSD
- Related log if you're reporting an issue:
====
I want to suspend a user account from receiving e-mail but the user still be able to access the mailbox. I tried to change the user settings in user profile > Advanced > Enabled Services > "Receiving mails for this account on mail server". I enabled this option but still receiving e-mail, what I am setting wrong? Please kindly help and advise.

----

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

2

Re: Suspend receiving e-mail

russell.chu wrote:

I tried to change the user settings in user profile > Advanced > Enabled Services > "Receiving mails for this account on mail server". I enabled this option but still receiving e-mail

You should uncheck this option, did you?

Could you please show us some addition info to help troubleshoot:

1) Show us output of below SQL commands (NOTE: Remove password in its output before pasting):

mysql> USE vmail;
mysql> SELECT * FROM mailbox WHERE username='[your_user_email]' LIMIT 1;

2) Paste file content: /usr/local/etc/dovecot/dovecot-mysql.conf. WARNING: Remove password in this file before pasting. Please paste file content instead of attaching it in your post.

3

Re: Suspend receiving e-mail

Yes, the services option "Receiving mails for this account on mail server" in user profile is unchecked.

Here the SQL commands result:
| username                 | password                           | name         | language | storagebasedirectory | storagenode | maildir                   | quota | domain       | transport | department | rank   | employeeid | isadmin | isglobaladmin | enablesmtp | enablesmtpsecured | enablepop3 | enablepop3secured | enableimap | enableimapsecured | enabledeliver | enablelda | enablemanagesieve | enablemanagesievesecured | enablesieve | enablesievesecured | enableinternal | enabledoveadm | enablelib-storage | lastlogindate       | lastloginipv4 | lastloginprotocol | disclaimer | passwordlastchange  | created             | modified            | expired             | active | local_part  | bytes | messages | allowedsenders | rejectedsenders | allowedrecipients | rejectedrecipients | enablelmtp | settings |
+--------------------------+------------------------------------+--------------+----------+----------------------+-------------+---------------------------+-------+--------------+-----------+------------+--------+------------+---------+---------------+------------+-------------------+------------+-------------------+------------+-------------------+---------------+-----------+-------------------+--------------------------+-------------+--------------------+----------------+---------------+-------------------+---------------------+---------------+-------------------+------------+---------------------+---------------------+---------------------+---------------------+--------+-------------+-------+----------+----------------+-----------------+-------------------+--------------------+------------+----------+
| gfung@domain.com | $hashedpassword | G Fung | en_US    | /var/vmail           | vmail1      | domain.com/gfung/ |  7168 | domain.com |           |            | normal |            |       0 |             0 |          0 |                 0 |          0 |                 0 |          1 |                 1 |             0 |         1 |                 1 |                        1 |           1 |                  1 |              1 |             1 |                 1 | 0000-00-00 00:00:00 |             0 |                   |            | 2014-07-02 01:19:45 | 2012-12-12 00:00:00 | 2014-08-14 09:51:35 | 9999-12-31 00:00:00 |      1 | gfung |     0 |        0 |                |                 |                   |                    |          1 |         

File content: /usr/local/etc/dovecot/dovecot-mysql.conf:
driver = mysql
default_pass_scheme = CRYPT
connect = host=127.0.0.1 dbname=vmail user=vmail password=encrypedpassword
# Required by 'doveadm mailbox ...'.
iterate_query = SELECT username AS user FROM mailbox
password_query = SELECT password FROM mailbox WHERE username='%u' AND active='1'
user_query = SELECT \
    CONCAT(mailbox.storagebasedirectory, '/', mailbox.storagenode, '/', mailbox.maildir) AS home, \
    CONCAT('*:bytes=', mailbox.quota*1048576) AS quota_rule \
FROM mailbox,domain \
WHERE mailbox.username='%u' \
    AND mailbox.domain='%d' \
    AND mailbox.`enable%Ls%Lc`=1 \
    AND mailbox.domain=domain.domain \
    AND domain.backupmx=0 \
    AND domain.active=1 \
    AND mailbox.active=1

4

Re: Suspend receiving e-mail

*) Does it work if you set 'mailbox.enablelda=0' for this user manually with MySQL command line tool?
*) May i know which version of Dovecot are you running?

5

Re: Suspend receiving e-mail

Thanks for you prompt reply Zhang.

I tested for different options and settings, the result is no matter what I set the "Receiving mails for this account on mail server", the MySQL table field mailbox.enablelda didn't change value. If I manually change the table mailbox.enablelda=0, then it works as expected.

The dovecot version that I am running is dovecot-2.1.12

Thanks for your time and help.

6

Re: Suspend receiving e-mail

Here's patch for iRedAdmin-Pro-MySQL-1.8.2 and iRedAdmin-Pro-PGSQL-1.4.2 to fix this issue:

--- a/lib/mysql/user.py.orig    2014-06-12 08:55:30.130693455 -0600
+++ b/lib/mysql/user.py    2014-08-20 21:31:40.220424450 -0600
@@ -891,6 +891,14 @@
             else:
                 self.disabledService += ['enablesievesecured']
 
+            # Receiving email on server for this user
+            if 'enabledeliver' in self.enabledService:
+                self.enabledService += ['enablelda']
+                self.enabledService += ['enablelmtp']
+            else:
+                self.disabledService += ['enablelda']
+                self.disabledService += ['enablelmtp']
+
             self.disabledService += [v for v in ENABLED_SERVICES if v not in self.enabledService]
 
             # Enable/disable services.

7

Re: Suspend receiving e-mail

Thanks for the response Zhang. I tried the patch but it doesn't work. Change the status of "Receiving mails for this account on mail server" didn't save to database.

8

Re: Suspend receiving e-mail

Did you restart Apache web server after patching?

9

Re: Suspend receiving e-mail

Thankyou Zhang. You're right, Apache needs to be restarted to take effective. It works !
Thanks again for your great help and prompt reply Zhang.