1

Topic: e-mail alias not working on FreeBSD/MySQL 1.0beta1

==== REQUIRED BASIC INFO OF YOUR IREDMAIL SERVER ====
- iRedMail version (check /etc/iredmail-release): 1.0-beta1
- Deployed with iRedMail Easy or the downloadable installer? downloadable installer
- Linux/BSD distribution name and version: FreeBSD 11.2
- Store mail accounts in which backend (LDAP/MySQL/PGSQL): MySQL
- 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.
====

I wanted to setup an alias for one of my mailboxes so I followed the instructions here using the SQL command line: https://docs.iredmail.org/sql.create.mail.alias.html, however it is not working.

I am trying to have messages from email2@mydomain.com appear in the inbox of email1@mydomain.com

When I send e-mail to email2@mydomain.com the address is not found and bounces.

Here's the select * from the alias and forwardings tables:

---
select * from alias;
---
+-------------------+------+--------------+--------------+---------------------+---------------------+---------------------+--------+
| address           | name | accesspolicy | domain       | created             | modified            | expired             | active |
+-------------------+------+--------------+--------------+---------------------+---------------------+---------------------+--------+
| email2@mydomain.com |      | public       | mydomain.com | 1970-01-01 01:01:01 | 1970-01-01 01:01:01 | 9999-12-31 00:00:00 |      1 |
+-------------------+------+--------------+--------------+---------------------+---------------------+---------------------+--------+

---
select * from forwardings;
---
+----+-------------------------+-------------------------+--------------+--------------+-------------+---------+---------------+----------+--------+
| id | address                 | forwarding              | domain       | dest_domain  | is_maillist | is_list | is_forwarding | is_alias | active |
+----+-------------------------+-------------------------+--------------+--------------+-------------+---------+---------------+----------+--------+
|  1 | postmaster@mydomain.com | postmaster@mydomain.com | mydomain.com | mydomain.com |           0 |       0 |             1 |        0 |      1 |
|  3 | email1@mydomain.com      | email1@mydomain.com      | mydomain.com |              |           0 |       0 |             1 |        0 |      1 |
|  5 | email2@mydomain.com       | email1@mydomain.com      | mydomain.com | mydomain.com |           0 |       0 |             1 |        1 |      1 |
+----+-------------------------+-------------------------+--------------+--------------+-------------+---------+---------------+----------+--------+

And here's the output in /var/log/maillog:

Oct  7 19:04:04 <mail.info> mx postfix/smtpd[87512]: connect from mail-qt1-f178.google.com[209.85.160.178]
Oct  7 19:04:04 <mail.info> mx postfix/smtpd[87512]: Anonymous TLS connection established from mail-qt1-f178.google.com[209.85.160.178]: TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)
Oct  7 19:04:04 <mail.info> mx postfix/smtpd[87512]: NOQUEUE: reject: RCPT from mail-qt1-f178.google.com[209.85.160.178]: 554 5.7.1 <email2@mydomain.com>: Recipient address rejected: Unknown user; from=<mygmailaccount@gmail.com> to=<email2@mydomain.com> proto=ESMTP helo=<mail-qt1-f178.google.com>
Oct  7 19:04:04 <mail.info> mx postfix/smtpd[87512]: disconnect from mail-qt1-f178.google.com[209.85.160.178] ehlo=2 starttls=1 mail=1 rcpt=0/1 bdat=0/1 quit=1 commands=5/7

Is there something I'm missing?  Thank you!

----

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

2

Re: e-mail alias not working on FreeBSD/MySQL 1.0beta1

- The SQL records seem fine.
- Does restarting Postfix fix the issue?  If not, please show me output of commands below:

cd /usr/local/etc/postfix/mysql/
for i in $(ls *cf); do echo $i; postmap -q email2@mydomain.com mysql:./$i; done

3

Re: e-mail alias not working on FreeBSD/MySQL 1.0beta1

No, restarting postfix doesn't change the error.  I've done a 'service postfix restart' after each change, but the error is still there.

Running "for i in $(ls *cf); do echo $i; postmap -q email2@mydomain.com mysql:./$i; done" returns with:

Illegal variable name.

4

Re: e-mail alias not working on FreeBSD/MySQL 1.0beta1

blacksteel1288 wrote:

Illegal variable name.

This is quite weird and unexpected result.
Could you please paste original commands and output here for troubleshooting?

5

Re: e-mail alias not working on FreeBSD/MySQL 1.0beta1

I realized the reason that script is failing is because you're using bash, not csh, which is default in my FreeBSD install.  So doing this:

bash
cd /usr/local/etc/postfix/mysql/
for i in $(ls *cf); do echo $i; postmap -q email2@mydomain.com mysql:./$i; done

Results in this:

catchall_maps.cf
domain_alias_catchall_maps.cf
domain_alias_maps.cf
recipient_bcc_maps_domain.cf
recipient_bcc_maps_user.cf
relay_domains.cf
sender_bcc_maps_domain.cf
sender_bcc_maps_user.cf
sender_dependent_relayhost_maps.cf
sender_login_maps.cf
transport_maps_domain.cf
transport_maps_maillist.cf
transport_maps_user.cf
virtual_alias_maps.cf
email1@mydomain.com
virtual_mailbox_domains.cf
virtual_mailbox_maps.cf

6

Re: e-mail alias not working on FreeBSD/MySQL 1.0beta1

blacksteel1288 wrote:

virtual_alias_maps.cf
email1@mydomain.com

As you can see, it correctly returns the forwarding address.
I will check this issue later.

7

Re: e-mail alias not working on FreeBSD/MySQL 1.0beta1

Any news on this?

Should I just try updating to beta2?  (If so, how?)

8

Re: e-mail alias not working on FreeBSD/MySQL 1.0beta1

Show me output of commands below:

cd /usr/local/etc/postfix/mysql/
grep 'query' transport_maps_domain.cf virtual_mailbox_domains.cf

9

Re: e-mail alias not working on FreeBSD/MySQL 1.0beta1

Here's the results:

root@mx:~ # cd /usr/local/etc/postfix/mysql/
root@mx:/usr/local/etc/postfix/mysql # grep 'query' transport_maps_domain.cf virtual_mailbox_domains.cf
transport_maps_domain.cf:query       = SELECT transport FROM domain WHERE domain='%s' AND active=1
virtual_mailbox_domains.cf:query       = SELECT domain FROM domain WHERE domain='%s' AND backupmx=0 AND active=1 UNION SELECT alias_domain.alias_domain FROM alias_domain,domain WHERE alias_domain.alias_domain='%s' AND alias_domain.active=1 AND alias_domain.target_domain=domain.domain AND domain.active=1 AND domain.backupmx=0

10

Re: e-mail alias not working on FreeBSD/MySQL 1.0beta1

The config file is ok. I cannot figure it out without direct ssh access which requires a support ticket.

if this is a testing server, please try to re-deploy iRedMail with the iRedMail-1.0-beta2.
If you don't mind running a Linux or OpenBSD mail server, try the supported Linux/OpenBSD distro for testing or even in production.

11

Re: e-mail alias not working on FreeBSD/MySQL 1.0beta1

RE: Linux. I can only run on FreeBSD since this is running in a FreeNAS jail.

I can re-deploy, but I'd like to keep the current configs so I don't have to reset everything.  Is there an easy way to deploy beta2 over beta1 without doing a clean install?

12

Re: e-mail alias not working on FreeBSD/MySQL 1.0beta1

blacksteel1288 wrote:

Is there an easy way to deploy beta2 over beta1 without doing a clean install?

Unfortunately, no. sorry.

13

Re: e-mail alias not working on FreeBSD/MySQL 1.0beta1

Update:  After a clean install of iRedMail 1.0 on the same server & config from the original post, and the e-mail alias forwarding works fine now.  OK to close!  Thanks.