Add configuration option to alias entire domains and respective tests
This commit is contained in:
parent
48bd6b8981
commit
c90e09d125
3 changed files with 71 additions and 2 deletions
|
|
@ -48,8 +48,11 @@ in
|
|||
environment.systemPackages = with pkgs; [netcat];
|
||||
mailsystem = {
|
||||
fqdn = "mail.example.com";
|
||||
domains = ["example.com" "otherdomain.com"];
|
||||
domains = ["example.com" "aliased.com" "otherdomain.com"];
|
||||
accounts = mkAccounts accounts;
|
||||
virtualDomainAliases = {
|
||||
"aliased.com" = "example.com";
|
||||
};
|
||||
extraVirtualAliases = {
|
||||
"extra-alias@example.com" = accounts."extra-alias".address;
|
||||
};
|
||||
|
|
@ -191,5 +194,37 @@ in
|
|||
client.execute("${cleanupMail}")
|
||||
# fetchmail returns EXIT_CODE 0 when it retrieves mail
|
||||
client.succeed("${recvMail "extra-alias"} >&2")
|
||||
|
||||
with subtest("receiving mail on aliased domain using normal account"):
|
||||
client.succeed("${sendMail "normal" "" "user2@aliased.com" ''
|
||||
Subject: aliasedDomain with normal account
|
||||
|
||||
Hello User2,
|
||||
this is mail is sent to you by using your address @example.org.
|
||||
''}")
|
||||
server.wait_until_fails('${pendingPostqueue}')
|
||||
client.execute("${cleanupMail}")
|
||||
# fetchmail returns EXIT_CODE 0 when it retrieves mail
|
||||
client.succeed("${recvMail "normal2"} >&2")
|
||||
|
||||
with subtest("receiving mail on aliased domain using catchall-account"):
|
||||
client.succeed("${sendMail "normal" "" "somerandomaddress@aliased.com" ''
|
||||
Subject: aliasedDomain using catchall-account
|
||||
|
||||
Hello Catchall-User,
|
||||
this is mail is sent to you by using an address without any user-account behind it for neither @example.com nor @aliased.com.
|
||||
''}")
|
||||
server.wait_until_fails('${pendingPostqueue}')
|
||||
client.execute("${cleanupMail}")
|
||||
# fetchmail returns EXIT_CODE 0 when it retrieves mail
|
||||
client.succeed("${recvMail "catchall"} >&2")
|
||||
|
||||
with subtest("sending mail from aliased domain fails"):
|
||||
client.fail("${sendMail "normal" "user1@aliased.com" accounts."normal2".address ''
|
||||
Subject: aliasedDomain
|
||||
|
||||
Hello User2,
|
||||
this mail should not be dispatched to you as I'm using "my" address @aliased.com.
|
||||
''}")
|
||||
'';
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue