Solved: Postfix / Snappymail - how to set mailidentity to group mail alias

So far, so good.

Replying to the ‘forwarded’ mail using the groupalias-address does not work though: Postfix says

NOQUEUE: reject: RCPT from domain.tld[fe80::b2de:ebff:fe5a:2668]: 553 5.7.1 <pianomail@domain.tld>: Sender address rejected: not owned by user piano_w; from=<pianomailo@domain.tld> to=<teacher@musicschool.tld> p
roto=ESMTP helo=<domain.tld>

I am allowed to use the groupalias as reply-to in the identity, but in that case the sender is still my own address and the identity is not selected automatically (there is no match on the email address, after all)

This problem is closely related to my earlier question regarding aliases within the same account.

Yesterday I turned out to be testing with the wrong address. What I learned I can bring into practice now, by adding the file ldap-groups.cf as smtpd_sender_login_map in main.cf:

smtpd_sender_login_maps=
   # Regular Yunohost accounts
   ldap:/etc/postfix/ldap-accounts.cf,
   # test: add the groups file, to see whether it works for group alias mail addresses in identities
   ldap:/etc/postfix/ldap-groups.cf,
   # Extra maps for app system users who need to send emails
   hash:/etc/postfix/app_senders_login_maps

The mail disappears when clicking “Send”, and the NOQUEUE message does not appear:

Dec 28 13:29:48 domain postfix/smtpd[1345832]: D20F02BE0637: client=domain.tld[fe80::b2de:ebff:fe5a:2668], sasl_method=PLAIN, sasl_username=wbk
Dec 28 13:29:48 domain postsrsd[1345839]: srs_forward: <pianomail@domain.tld> not rewritten: Domain excluded by policy
Dec 28 13:29:48 domain postfix/cleanup[1345838]: D20F02BE0637: message-id=<c3eeb7a417eae33374beed27d723aa2ea7c73c93@domain.tld>

I don’t know what to make of the not rewritten: Domain excluded by policy line, but that is for another time.

The mail arrives on the other end “as expected” (hoped, actually :stuck_out_tongue: ) and the ‘from’ and ‘reply-to’ addresses match what I set in the identity.