1 (edited by craig 2018-09-24 15:41:39)

Topic: Why is this account saving a copy of forwarded mail?

======== REQUIRED BASIC INFO OF YOUR IREDMAIL SERVER ====
- iRedMail version (check /etc/iredmail-release): 0.9.8
- Linux/BSD distribution name and version: CentOS 7.5
- Store mail accounts in which backend (LDAP/MySQL/PGSQL): MariaDB
- Web server (Apache or Nginx): Nginx
- Manage mail accounts with iRedAdmin-Pro?: No
- [IMPORTANT] Related original log or error message is required if you're experiencing an issue.
====

The default record in vmail/forwardings for an account added in iRedAdmin is as follows:

address                forwarding            domain        dest_domain    is_forwarding    active
user1@domain1.com    user1@domain1.com    domain1.com    EMPTY        1                1

SQL: User mail forwarding implies that if you set up forwarding, email is *not* saved in the account by default, and you have to set it up explicitly if you want that. However, despite the fact that I have set up forwarding for user@domain1.com as follows, email is being saved in its account.

address                forwarding            domain        dest_domain    is_forwarding    active
user1@domain1.com    user2@domain2.com    domain1.com    domain2.com    1                1

Do I understand the documentation incorrectly? Do I have to explicitly disable saving email in the account? Forwarding is working correctly, but mails are being saved in user1@domain1.com.

----

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

2

Re: Why is this account saving a copy of forwarded mail?

Do you have any other records with 'address=user1@domain1.com" in "forwardings" table?

3

Re: Why is this account saving a copy of forwarded mail?

Hi Zhang,

Thanks for your reply. No, just the two I show above:

MariaDB [vmail]> select * from forwardings where address="user1@domain1.com";
+----+-------------------+-------------------+-------------+-------------+-------------+---------+---------------+----------+--------+
| id | address           | forwarding        | domain      | dest_domain | is_maillist | is_list | is_forwarding | is_alias | active |
+----+-------------------+-------------------+-------------+-------------+-------------+---------+---------------+----------+--------+
| 70 | user1@domain1.com | user1@domain1.com | domain1.com |             |           0 |       0 |             1 |        0 |      1 |
| 71 | user1@domain1.com | user2@domain2.com | domain1.com | domain2.com |           0 |       0 |             1 |        0 |      1 |
+----+-------------------+-------------------+-------------+-------------+-------------+---------+---------------+----------+--------+
2 rows in set (0.00 sec)

MariaDB [vmail]>

Craig

4

Re: Why is this account saving a copy of forwarded mail?

Too bad the "code" tag doesn't produce monospaced font.

5

Re: Why is this account saving a copy of forwarded mail?

craig wrote:

| 70 | user1@domain1.com | user1@domain1.com | domain1.com |             |           0 |       0 |             1 |        0 |      1 |

1: This one doesn't look like generated by iRedAdmin-Pro because it misses value for column "dest_domain".
2: What Postfix needs are just 3 columns: address, domain, active. In your case, Postfix will get 2 records by sql query, that's why you get a copy saved in mailbox.

6 (edited by craig 2018-09-26 14:41:27)

Re: Why is this account saving a copy of forwarded mail?

Hi Zhang,

Thanks for your reply.

ZhangHuangbin wrote:

1: This one doesn't look like generated by iRedAdmin-Pro because it misses value for column "dest_domain".

Record 70, the one to which you refer, was generated by iRedAdmin (non-Pro, which is why I've posted this in the iRedMail Support section), when the user was added there. This is on a month-old, new server. All of the users added under iRedAdmin look the same, with nothing in the "dest_domain" column, but I note that on my Pro server *no* records in the "forwardings" table are blank. Record 71 was added using the instructions at https://docs.iredmail.org/sql.user.mail.forwarding.html , which are INSERT commands instead of the UPDATE commands I'd expect if the instructions were to modify an existing row.

ZhangHuangbin wrote:

2: What Postfix needs are just 3 columns: address, domain, active. In your case, Postfix will get 2 records by sql query, that's why you get a copy saved in mailbox.

OK, so it's not clear to me then what I should have if I only want mail to user1@domain1.com to be redirected to user2@domain2.com, since that seems to differ from what is at the "SQL: User mail forwarding" link above.


Craig

7

Re: Why is this account saving a copy of forwarded mail?

Hi Craig,

- If you want to save a copy, make sure you have record with 'address=<user>, forwarding=<same-user>'.
- If you do not want to save a copy, make sure you do not have record with 'address=<user>, forwarding=<same-user>'.

8

Re: Why is this account saving a copy of forwarded mail?

Updating this, finally, this address was my contact in domains' WHOIS, which meant it received a lot of spam. I've since changed my WHOIS address, but there is one registrar that won't change it. So I activate it once a year when I expect the invoice via email.

In order to accomplish this I deactivate the address/user in the iRedAdmin (non-Pro) interface, and change the "active" column for the forwarding alias to 0 in the database. Then I reverse the two to reactivate.


Craig