1 (edited by srd2010 2017-10-30 23:52:07)

Topic: BCC Settings on Alias Domain

==== Required information ====
- iRedMail version (check /etc/iredmail-release): 0.9.7
- Linux/BSD distribution name and version: Debian 7
- Store mail accounts in which backend (LDAP/MySQL/PGSQL): MySQL
- Web server (Apache or Nginx): Apache
- Manage mail accounts with iRedAdmin-Pro? Yes
====

Hi,

we've adapted a new Customer with multiple Domains.
We used one domain as Main Domain and added the others as Alias Domains.

Now, the customer wants the email for one regular user account to also be forwarded to another e-mail address, so we figured we just use BCC on incoming emails.

user@maindomain.net -> example@domain.com  | OK
user@aliasdomain.com -> example@domain.com | NOT WORKING

This works for the Main Account, but sending an e-mail to the same account with an alias Domain, the mail is not forwarded, but both e-mails are received within the original account.

Is this a bug or how can we achieve that ?


Thanks,
Frank

----

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

2

Re: BCC Settings on Alias Domain

BCC supports only one recipient, you should try mail forwarding instead.

3

Re: BCC Settings on Alias Domain

Hi Zhang,

maybe i did not explain it correctly.
It's only one receipient.

the account is user@maindomain.net" where the BCC incoming mail is set to example@domain.com

now, there are also alias domains to maindomain.net, for example: aliasdomain.com

so user will receive emails to his account to either address:
user@maindomain.net
user@aliasdomain.com

Now, the only thing not working is the BCC if the receiving email is one of the alias Domains, so a mail to:
user@maindomain.net -> example@domain.com  | OK
user@aliasdomain.com -> example@domain.com | NOT WORKING

But both emails are delivered to the main account.

Hope explanation helps to understand the problem.

Thanks
Frank

4

Re: BCC Settings on Alias Domain

Understand now. Seems Postfix BCC lookup doesn't query alias domain at all. I will try to fix it today.

5

Re: BCC Settings on Alias Domain

Unfortunately, i cannot reproduce this issue. Could you please try commands below and paste me the output?

cd /etc/postfix/mysql/
for i in $(ls *bcc*); do echo $i; postmap -q 'user@aliasdomain.com' mysql:./$i; done

Please replace 'user@aliasdomain.com' by the real address in alias domain.

6 (edited by srd2010 2017-11-11 23:24:57)

Re: BCC Settings on Alias Domain

MAIN DOMAIN:

for i in $(ls *bcc*); do echo $i; postmap -q 'user@maindomain.net' mysql:./$i; done
recipient_bcc_maps_domain.cf
recipient_bcc_maps_user.cf
BCCEMAIL@BCCDOMAIN.COM
sender_bcc_maps_domain.cf
sender_bcc_maps_user.cf


ALIAS DOMAIN:

for i in $(ls *bcc*); do echo $i; postmap -q 'user@aliasdomain.com' mysql:./$i; done
recipient_bcc_maps_domain.cf
recipient_bcc_maps_user.cf
sender_bcc_maps_domain.cf
sender_bcc_maps_user.cf

7

Re: BCC Settings on Alias Domain

srd2010 wrote:

ALIAS DOMAIN:

for i in $(ls *bcc*); do echo $i; postmap -q 'user@aliasdomain.com' mysql:./$i; done
recipient_bcc_maps_domain.cf
recipient_bcc_maps_user.cf
sender_bcc_maps_domain.cf
sender_bcc_maps_user.cf

hmm, no bcc returned.

Could you please compare your /etc/postfix/mysql/*.cf with official config files first? Let's get rid of possible issues caused by custom SQL queries first.
https://bitbucket.org/zhb/iredmail/src/ … fix/mysql/

8

Re: BCC Settings on Alias Domain

There is a difference in File: virtual_alias_maps.cf

Our Query:
query       = SELECT forwardings.forwarding FROM forwardings,domain WHERE forwardings.address='%s' AND forwardings.domain='%d' AND forwardings.domain=domain.domain AND forwardings.active=1 AND domain.backupmx=0 AND domain.active=1

Original Query:
query       = SELECT forwardings.forwarding FROM forwardings,domain WHERE forwardings.address='%s' AND forwardings.domain=domain.domain AND forwardings.active=1 AND domain.backupmx=0 AND domain.active=1


We've changed the query to the orginal for testing purposes but no change in result.

9

Re: BCC Settings on Alias Domain

Fixed. Please update the "query =" setting in 2 files:

File: /etc/postfix/mysql/recipient_bcc_maps_user.cf

query       = SELECT recipient_bcc_user.bcc_address
                FROM recipient_bcc_user,domain,alias_domain
               WHERE recipient_bcc_user.username='%s'
                     AND recipient_bcc_user.domain='%d'
                     AND ((recipient_bcc_user.domain=domain.domain)
                          OR (recipient_bcc_user.domain=alias_domain.alias_domain AND domain.domain = alias_domain.target_domain))
                     AND domain.backupmx=0
                     AND domain.active=1
                     AND recipient_bcc_user.active=1

File: /etc/postfix/mysql/sender_bcc_maps_user.cf

query       = SELECT sender_bcc_user.bcc_address
                FROM sender_bcc_user,domain,alias_domain
               WHERE sender_bcc_user.username='%s'
                     AND sender_bcc_user.domain='%d'
                     AND ((sender_bcc_user.domain=domain.domain)
                          OR (sender_bcc_user.domain=alias_domain.alias_domain AND domain.domain = alias_domain.target_domain))
                     AND domain.backupmx=0
                     AND domain.active=1
                     AND sender_bcc_user.active=1

Let me know whether it works for you.

10

Re: BCC Settings on Alias Domain

looking better for the ALIAS DOMAIN but now, for the Main Domain we get a massive amount of BCC Entries.

MAIN DOMAIN:
for i in $(ls *bcc*); do echo $i; postmap -q 'user@maindomain.net' mysql:./$i; done
recipient_bcc_maps_domain.cf
recipient_bcc_maps_user.cf
BCCEMAIL@BCCDOMAIN.COM,BCCEMAIL@BCCDOMAIN.COM,BCCEMAIL@BCCDOMAIN.COM,BCCEMAIL@BCCDOMAIN.COM,BCCEMAIL@BCCDOMAIN.COM,BCCEMAIL@BCCDOMAIN.COM,BCCEMAIL@BCCDOMAIN.COM,BCCEMAIL@BCCDOMAIN.COM,BCCEMAIL@BCCDOMAIN.COM,BCCEMAIL@BCCDOMAIN.COM,BCCEMAIL@BCCDOMAIN.COM,BCCEMAIL@BCCDOMAIN.COM,BCCEMAIL@BCCDOMAIN.COM,BCCEMAIL@BCCDOMAIN.COM,BCCEMAIL@BCCDOMAIN.COM,BCCEMAIL@BCCDOMAIN.COM,BCCEMAIL@BCCDOMAIN.COM,BCCEMAIL@BCCDOMAIN.COM,BCCEMAIL@BCCDOMAIN.COM,BCCEMAIL@BCCDOMAIN.COM,BCCEMAIL@BCCDOMAIN.COM,BCCEMAIL@BCCDOMAIN.COM,BCCEMAIL@BCCDOMAIN.COM,BCCEMAIL@BCCDOMAIN.COM,BCCEMAIL@BCCDOMAIN.COM,BCCEMAIL@BCCDOMAIN.COM,BCCEMAIL@BCCDOMAIN.COM
sender_bcc_maps_domain.cf
sender_bcc_maps_user.cf

ALIAS DOMAIN:
for i in $(ls *bcc*); do echo $i; postmap -q 'user@aliasdomain.com' mysql:./$i; done
recipient_bcc_maps_domain.cf
recipient_bcc_maps_user.cf
BCCEMAIL@BCCDOMAIN.COM
sender_bcc_maps_domain.cf
sender_bcc_maps_user.cf

This somehow doesn't feel correct. We changed back to old query.

11

Re: BCC Settings on Alias Domain

OK, try this:

See the new query condition like this?

                     AND ((sender_bcc_user.domain=domain.domain)
                          OR (sender_bcc_user.domain=alias_domain.alias_domain AND domain.domain = alias_domain.target_domain))
 

Try to improve it to make it right.

I will test it later these days, but how about giving it a try yourself to figure it out? big_smile