1 (edited by laserlight 2015-02-20 19:31:56)

Topic: Problem with setting up email alias with PostgreSQL

==== Required information ====
- iRedMail version: 0.9.0
- Store mail accounts in which backend (LDAP/MySQL/PGSQL): PGSQL
- Linux/BSD distribution name and version: Ubuntu 14.04.2 LTS (GNU/Linux 3.13.0-43-generic x86_64; Digital Ocean VPS 1 GB memory plan)
- Related log if you're reporting an issue: N/A
====

I have created an account, let's call it user@example.com, that works. Now, I am trying to create an alias for the same domain that goes to an external email account, let's say from alias@example.com to example@gmail.com (the actual destination is a Google Apps group that works, so it is effectively Gmail).

I followed the instructions to add a mail alias account for SQL:

INSERT INTO alias (address, goto, domain, created) VALUES ('alias@example.com', 'example@gmail.com', 'example.com', NOW());

However, when I sent an email to alias@example.com, I did not receive it at example@gmail.com (or rather, the Google Apps account that it should have been forwarded to). I did not receive a notification about a failure to send the email either (the test was done from user@example.com, as well as another Gmail account that successfully sent to user@example.com in an earlier test).

Running this in psql:

SELECT * FROM alias WHERE address='alias@example.com';

gives me:

      address      |        goto       | name | moderators | accesspolicy |   domain    | islist |          created           |      modified       |       expired       | active 
-------------------+-------------------+------+------------+--------------+-------------+--------+----------------------------+---------------------+---------------------+--------
 alias@example.com | example@gmail.com |      |            |              | example.com |      0 | 2015-02-20 13:30:05.663376 | 1970-01-01 00:00:00 | 9999-12-31 00:00:00 |      1

Running this:

postmap -q 'alias@example.com' pgsql:/etc/postfix/pgsql/virtual_alias_maps.cf

gives me:

example@gmail.com

I tried a variant of the workaround used by gigi2683 as described in Email alias in IredMail, i.e., since I could not find receive_override_options in /etc/postfix/main.cf, I edited /etc/postfix/master.cf to change this:

127.0.0.1:10025 inet n  -   -   -   -  smtpd
    -o content_filter=
    -o mynetworks_style=host
    -o mynetworks=127.0.0.0/8
    -o local_recipient_maps=
    -o relay_recipient_maps=
    -o strict_rfc821_envelopes=yes
    -o smtp_tls_security_level=none
    -o smtpd_tls_security_level=none
    -o smtpd_restriction_classes=
    -o smtpd_delay_reject=no
    -o smtpd_client_restrictions=permit_mynetworks,reject
    -o smtpd_helo_restrictions=
    -o smtpd_sender_restrictions=
    -o smtpd_recipient_restrictions=permit_mynetworks,reject
    -o smtpd_end_of_data_restrictions=
    -o smtpd_error_sleep_time=0
    -o smtpd_soft_error_limit=1001
    -o smtpd_hard_error_limit=1000
    -o smtpd_client_connection_count_limit=0
    -o smtpd_client_connection_rate_limit=0
    -o receive_override_options=no_header_body_checks,no_unknown_recipient_checks,no_address_mappings

to:

127.0.0.1:10025 inet n  -   -   -   -  smtpd
    -o content_filter=
    -o mynetworks_style=host
    -o mynetworks=127.0.0.0/8
    -o local_recipient_maps=
    -o relay_recipient_maps=
    -o strict_rfc821_envelopes=yes
    -o smtp_tls_security_level=none
    -o smtpd_tls_security_level=none
    -o smtpd_restriction_classes=
    -o smtpd_delay_reject=no
    -o smtpd_client_restrictions=permit_mynetworks,reject
    -o smtpd_helo_restrictions=
    -o smtpd_sender_restrictions=
    -o smtpd_recipient_restrictions=permit_mynetworks,reject
    -o smtpd_end_of_data_restrictions=
    -o smtpd_error_sleep_time=0
    -o smtpd_soft_error_limit=1001
    -o smtpd_hard_error_limit=1000
    -o smtpd_client_connection_count_limit=0
    -o smtpd_client_connection_rate_limit=0
    -o receive_override_options=no_header_body_checks,no_unknown_recipient_checks,#no_address_mappings

then restarted postfix, but to no avail.

What should I do to fix this problem? Thanks!

EDIT:
I also tried changing the accesspolicy field in vmail.alias to public, but it made no difference.

----

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

2

Re: Problem with setting up email alias with PostgreSQL

Sorry about this trouble, i forgot to mention that you must set column 'alias.isalias=1'  for this alias account, this column is required in recent iRedMail release.

I will updated the document immediately.

3 (edited by laserlight 2015-02-20 23:14:17)

Re: Problem with setting up email alias with PostgreSQL

ZhangHuangbin wrote:

Sorry about this trouble

No worries!

ZhangHuangbin wrote:

i forgot to mention that you must set column 'alias.isalias=1'  for this alias account, this column is required in recent iRedMail release.

I see. Does this mean that I should run an ALTER TABLE statement to add an isalias column defined similiar to the islist column? It seems rather strange though as the table name already implies that the entries are aliases, except that some aliases may be for the purpose of a list.

EDIT:
I have tried the above but it did not work. As stated earlier, I installed iRedMail 0.9.0, not the development version, so perhaps this isalias column change only applies post 0.9.0?

4

Re: Problem with setting up email alias with PostgreSQL

An update: I decided to rebuild the mail server, this time using the ufw iptables frontend instead of the iRedMail default firewall rules + my attempt to copy that for ip6tables, and suddenly the mail aliases work.

As such, it clearly is not about the isalias column, at least for the current version of iRedMail (0.9.0). I suggest that the documentation be modified to clarify to the reader that setting the isalias field to 1 is required if the column actually exists, but not for 0.9.0 and earlier where it does not exist.

Thanks!

5

Re: Problem with setting up email alias with PostgreSQL

laserlight wrote:

I see. Does this mean that I should run an ALTER TABLE statement to add an isalias column defined similiar to the islist column? It seems rather strange though as the table name already implies that the entries are aliases, except that some aliases may be for the purpose of a list.

My mistake, it's 'alias.islist', not 'alias.isalias' column. Sorry about this.

6

Re: Problem with setting up email alias with PostgreSQL

I see. However, I left islist=0 for my alias and it worked, at least on iRedMail 0.9.0.

7

Re: Problem with setting up email alias with PostgreSQL

'aliasislist=0' means this is a normal mail user, and it becomes mail forwarding for this mail user.