1

Topic: mail relay and alias domains

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

===

Hi,
When I set a per domain relay it works as expected. Relays all mail to another server.
For the same domain I have set alias domains. Sending mails to an 'alias domain" reads MX from DNS and forwards a message there instead of relaying to specified server.

2

Re: mail relay and alias domains

Check file /etc/postfix/mysql/relay_domains.cf, i think we need to improve the SQL query in this file to handle alias domain.

Do you have any interest to help fix it?

----

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: mail relay and alias domains

Yes I do.
What I'd like to achieve is to have one common black and whitelist for a couple of domains which I host.

To be more specific.
I have about 15 domains.
4 of them is relaying to an exchange server of one of my clients.
Let's name them domain.com , domain.co.uk, domain2.com, domian2.co.uk.
Iredmail acts there as a spamfilter without recipent verification.
In can specify 4 different domains and everything is fine, however than client needs to modify each white and blacklist 4 times.

I wanted to set one domain to avoid this.
I've specified domain.com as domain and the rest as alias domains
I also want a domain to stays the same (no change like domain.co.uk->domain.com)

Thought that alias domain can handle it.

4

Re: mail relay and alias domains

What's the related log of white/blacklisting in iRedAPD? You can turn on debug mode in iRedAPD for debugging:
https://docs.iredmail.org/debug.iredapd.html

Also, we need to improve SQL query in /etc/postfix/mysql/relay_domains.cf to handle alias domain.

----

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: mail relay and alias domains

Hi @misieq,

Could you please help test this SQL query in /etc/postfix/mysql/relay_domains.cf? Replace old "query =" line by lines below. it works for me during testing.

query       = (SELECT domain
                 FROM domain
                WHERE domain='%s'
                      AND backupmx=1
                      AND active=1
                LIMIT 1)
                UNION
              (SELECT alias_domain.target_domain
                 FROM alias_domain, domain
                WHERE alias_domain.alias_domain='%s'
                      AND alias_domain.target_domain=domain.domain
                      AND domain.backupmx=1
                      AND domain.active=1
                LIMIT 1)

----

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

buy me a cup of coffee

6

Re: mail relay and alias domains

It didn't work for me.
I've enabled iredapd debug, however no information about relay query can be found there.