Closed joehealy closed 6 years ago
This sounds like you want to create a mailing list albeit a small one. I have googled a bit and it seems with postfix you can do this:
# main.cf
virtual_alias_maps = hash:/etc/postfix/virtual
# virtual
updates@example.com user1@example.com, user2@example.com, # etc
I don't think this is possible (right now) when using NMS due to the way it creates the alias file. So IMHO you have two good options:
So what is it going to be?
I wouldn't mind a PR for this at all. Nonetheless, normally this problem is solved by adding additional recipients to the sending mail.
As a workaround you could use a sieve script and two distinct accounts:
require ["copy"];
redirect :copy "user2@example.com";
(Untested but should work)
@phdoerfler @r-raymond good to know there is not existing functionality for this - I'd looked, but couldn't see it anywhere.
I'm happy to try to put together a pull request. The simplest case would be just to permit anything at all in the extraVirtualAliases, though I'm not sure where the restrictions are set right now. See below:
Right now, when I try the following:
extraVirtualAliases = {
"info@domain1" = "u1@domain1,u2@domain1,u3@domain1";
};
I get the following error:
error: The option value mailserver.extraVirtualAliases.info@domain1' in
/etc/nixos/mailserver.nix' is not of type `one of "u1@domain1", "u2@domain1", "u3@domain1"'.
How is this restriction enforced?
Thanks for putting work into this! It is inforced by the type:
type = types.attrsOf (types.enum (builtins.attrNames cfg.loginAccounts));
so the right hand side has to be an enum with possible choices defined by the loginAccounts. The conundrum is that we can't really change this to all possible values for comma seperated addresses (which would grow with n!). What we could do though is add a list type to the right hand side, so that multiple assignments are allowed and collected. Then it could be
"info@..." = "u1@..."
"info@..." = "u2@..."
...
Of course the logic writing the valiases file would need modifications.
How do you send email to multiple virtual accounts?
ie office@domain goes to account1@domain and account2@domain?
Adding office@domain to each of the accounts aliases attribute results in mail only being sent to one of the accounts