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!

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

----

Does my reply help a little? How about buying me a cup of coffee ($5) as an encouragement?

buy me a cup of coffee

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?

----

Does my reply help a little? How about buying me a cup of coffee ($5) as an encouragement?

buy me a cup of coffee

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