2

Basically this is the setup I am currently using:

virtual_alias_maps
  x1 x2

recipient_bcc_maps
  x2 x3

When I send an e-mail to x1, I expect it to be forwarded to x2, and then copied to x3, but what happens instead is the email comes up to x2 and then it is not copied further to x3.

This happens because the recipient field of the forwarded email's header (original mail from:x1 -> rcpt to:x2) doesn't contain x2, so x2 cc table is not checked..

Did anyone had experience with a situation like the above?

Thanks, M F

2 Answers2

2

If anyone has a similar problem, I solved it by switching entirely from recipient_bcc_maps to virtual_alias_maps.

The config is:

main.cf
virtual_alias_maps = mysql:/etc/postfix/sqlconf/virtual_mailbox_maps.cf

virtual_mailbox_maps.cf
user            = vmail
password        = password
dbname          = mails
query           = SELECT concat(u.username,'@',u.domain) FROM users u WHERE u.username='%u' AND u.domain='%d' AND u.active='1' and u.type=0 UNION SELECT n.address FROM users u LEFT JOIN next n ON n.id = u.id WHERE u.username='%u' AND u.domain='%d' AND u.active='1';
hosts           = 127.0.0.1

Basically, if message should be forwarded then don't include current account, otherwise if it should be carbon copied, then include current account in the list of addresses where the message should be delivered

  • Nice Job working around the postfix limitation and making it easier to manage with the database! But I assume this doesn't BCC, only CC correct? – Jacob Evans Oct 27 '15 at 20:09
1

That's expected behavior because of how message headers are processed.

You would want to use this bcc map of you need original content for x1 to bcc x3, unless you want to use always_bcc if x3 is like an archive/abuse monitoring mailbox.

x1 x3
x2 x3 
Jacob Evans
  • 7,636
  • 3
  • 25
  • 55
  • Thanks for the answer, while it is possible to do it like this, it is not very convenient, because any time I add new forward rule, I will have to manually check whether the recipient (or any of it's descending bcc account) has bcc rule and copy the addresses to the forwarding rule. Also when changing the bcc settings of an account again I will have to check whether there are any accounts forwarding to that account, so it is not very practical solution. x3 is not archive mailbox by the way, it is just a regular account, so it could be x4 or anything else – Maryana Fisia Oct 17 '15 at 13:03
  • Correct, maybe exim would have some more flexibility for you – Jacob Evans Oct 17 '15 at 15:23