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

**URL:** https://forum.yunohost.org/t/solved-postfix-snappymail-how-to-set-mailidentity-to-group-mail-alias/27776
**Category:** Support
**Tags:** mail, postfix, snappymail, identity, english
**Created:** [December 27, 2023, 9:26pm UTC](https://forum.yunohost.org/t/solved-postfix-snappymail-how-to-set-mailidentity-to-group-mail-alias/27776 "2023-12-27T21:26:36Z")
**Posts on this page:** 1
**Showing post:** 2

<div class="post-metadata">

### Author: ![wbk](https://forum.yunohost.org/letter_avatar_proxy/v4/letter/w/e0b2c6/32.png) [@wbk](https://forum.yunohost.org/u/wbk)
#### Post date: [December 28, 2023, 1:38pm UTC](https://forum.yunohost.org/t/solved-postfix-snappymail-how-to-set-mailidentity-to-group-mail-alias/27776/2 "2023-12-28T13:38:19Z")

</div>

> [@wbk](#):
>
> if I understand correctly:
> 
> - I could delete the empty forwarding accounts that only exist for grouping email
> - replace the accounts by usergroups.
> - Then I can add the necessary email addresses to these groups (the addresses where people send their mail)
> - And add the actual receiving users to the group
> - that only works for users on this Yunohost
> - users on another Yunohost would get an empty forwarding account on this Yunohost; that forwarding user account will become member of the usergroup

So far, so good.

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

```auto
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](https://forum.yunohost.org/t/postfix-two-mail-related-questions/27774/3) 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`:

```auto
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:

```auto
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 😛 ) and the ‘from’ and ‘reply-to’ addresses match what I set in the identity.

---

_[View the full topic](https://forum.yunohost.org/t/solved-postfix-snappymail-how-to-set-mailidentity-to-group-mail-alias/27776)._
