1

Topic: All mail accounts also showing as aliases

==== Required information ====
- iRedMail version (check /etc/iredmail-release):  0.9.8
- Linux/BSD distribution name and version: RHEL6
- Store mail accounts in which backend (LDAP/MySQL/PGSQL): PGSQL
- Web server (Apache or Nginx): Apache
- Manage mail accounts with iRedAdmin-Pro? 2.9.0
- [IMPORTANT] Related original log or error message is required if you're experiencing an issue.
====

After going through the upgrade from iredmail 0.9.5-1 and iredAdmin-Pro-SQL-2.4.0, I see that when I search for a regular mail account, that account is also showing up as an alias. Things that are only aliases show up correctly, as only aliases.

Thanks.

----

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

2

Re: All mail accounts also showing as aliases

Could you please capture some screenshots to help us understand the issue?

3

Re: All mail accounts also showing as aliases

See the following image for what I get back when I search for myself:

http://www2.cnfusers.cornell.edu/pub/iredadmin-aliases.png

The details of the alias don't show anything under than the "enable this" checkbox checked. The "members" dialogue is blank, for example.

4

Re: All mail accounts also showing as aliases

Seems a bug of iRedAdmin-Pro, i will try to reproduce this issue and come back with a fix.
Thanks for the feedback.

5

Re: All mail accounts also showing as aliases

Sounds good.

6

Re: All mail accounts also showing as aliases

Hi @dwbotsch,

I cannot reproduce this issue with iRedAdmin-Pro, could you please show us output of SQL commands below?

SELECT * FROM forwardings WHERE address='botsch@<domain>';

Please use full email address of 'botsch@' in sql query.

7

Re: All mail accounts also showing as aliases

result below. Just the one.

Could it have anything to do with having alias domains set up (I have two set up for envelope) ?

 id  |             address              |           forwarding            |          domain          |       dest_domain        | is_list | is_forwarding | is_alias | active | is_maillist 
-----+----------------------------------+---------------------------------+--------------------------+--------------------------+---------+---------------+----------+--------+-------------
  74 | botsch@<domain>  | botsch@<domain> | <domain> | <domain> |       0 |             1 |        0 |      1 |           0
ZhangHuangbin wrote:

Hi @dwbotsch,

I cannot reproduce this issue with iRedAdmin-Pro, could you please show us output of SQL commands below?

SELECT * FROM forwardings WHERE address='botsch@<domain>';

Please use full email address of 'botsch@' in sql query.

8

Re: All mail accounts also showing as aliases

Please show me output of SQL command below:

SELECT * FROM alias WHERE address='botsch@<domain>';

9

Re: All mail accounts also showing as aliases

So there is an entry for every alias that is showing up. Here's the one for me:

vmail=# select * from alias where address like 'botsch@%';
             address             |              goto               | name | moderators | accesspolicy |          domain          |       created       |      modified       |       e
xpired       | active | islist | is_alias | alias_to 
---------------------------------+---------------------------------+------+------------+--------------+--------------------------+---------------------+---------------------+--------
-------------+--------+--------+----------+----------
 botsch@envelope.cnf.cornell.edu | botsch@envelope.cnf.cornell.edu |      |            |              | envelope.cnf.cornell.edu | 2012-06-27 17:33:22 | 2017-09-27 12:33:33 | 9999-12
-31 00:00:00 |      1 |      0 |        0 | 
(1 row)

So how did they get there I wonder?

10

Re: All mail accounts also showing as aliases

In iRedMail-0.9.6 and earlier releases, one mail user account will have one record in sql table "vmail.mailbox", also one in "vmail.alias". Since iRedMail-0.9.7, we changed the sql structure and move the record in "vmail.alias" to new table "vmail.forwardings".

This change was covered in iRedMail-0.9.7 upgrade tutorial:
https://docs.iredmail.org/upgrade.iredm … l-accounts

Seems you didn't follow our upgrade tutorial strictly, and missed some steps.

How to fix it it manually

Please double check 3 sql tables: mailbox, forwardings, alias.

- If user exists in "mailbox" AND "forwardings", it's SAFE to remove the record with same email address ("alias.address=<user-email>") from "alias" table.

- if user exists in "mailbox" and "alias" but NOT "forwardings", please get the value of sql column "alias.goto" and insert into "forwardings" like below. WARNING: if "alias.goto" contains multiple addresses, you must split them and insert record like below for EACH of them.

INSERT INTO forwardings (address, forwarding, domain, dest_domain, is_forwarding)
                 VALUES ('<user-mail>', '<goto-address>','<domain-of-user-mail>', '<domain-of-goto-address>', 1);

After added required records in "forwardings", it's safe to remove the record from "alias" table.

- If user exists in "mailbox", but neither "alias" nor "forwardings", run SQL command below to fix it:

INSERT INTO forwardings (address, forwarding, domain, dest_domain, is_forwarding)
                 VALUES ('<user-mail>', '<user-mail>','<domain-of-user-mail>', '<domain-of-user-mail>', 1);

11

Re: All mail accounts also showing as aliases

I was just doing a domain rename which required updating entries in tables. And during that I did notice that all three of those tables are populated. So it would appear that I indeed missed a step during the upgrade process.

Can you just clarify if:
1) all three tables are still used
2) and the purpose of each table

Thanks.

ZhangHuangbin wrote:

In iRedMail-0.9.6 and earlier releases, one mail user account will have one record in sql table "vmail.mailbox", also one in "vmail.alias". Since iRedMail-0.9.7, we changed the sql structure and move the record in "vmail.alias" to new table "vmail.forwardings".

This change was covered in iRedMail-0.9.7 upgrade tutorial:
https://docs.iredmail.org/upgrade.iredm … l-accounts

Seems you didn't follow our upgrade tutorial strictly, and missed some steps.

How to fix it it manually

Please double check 3 sql tables: mailbox, forwardings, alias.

- If user exists in "mailbox" AND "forwardings", it's SAFE to remove the record with same email address ("alias.address=<user-email>") from "alias" table.

- if user exists in "mailbox" and "alias" but NOT "forwardings", please get the value of sql column "alias.goto" and insert into "forwardings" like below. WARNING: if "alias.goto" contains multiple addresses, you must split them and insert record like below for EACH of them.

INSERT INTO forwardings (address, forwarding, domain, dest_domain, is_forwarding)
                 VALUES ('<user-mail>', '<goto-address>','<domain-of-user-mail>', '<domain-of-goto-address>', 1);

After added required records in "forwardings", it's safe to remove the record from "alias" table.

- If user exists in "mailbox", but neither "alias" nor "forwardings", run SQL command below to fix it:

INSERT INTO forwardings (address, forwarding, domain, dest_domain, is_forwarding)
                 VALUES ('<user-mail>', '<user-mail>','<domain-of-user-mail>', '<domain-of-user-mail>', 1);

12

Re: All mail accounts also showing as aliases

dwbotsch wrote:

1) all three tables are still used
2) and the purpose of each table

1) yes.
2)

- "mailbox": stores mail user accounts and detailed profiles.
- "alias": stores mail alias accounts and detailed profiles.
- "forwardings": stores source <-> destination mapping for mail user account, mail alias account, (mlmmj) mailing list account.