1

Topic: create email address that can only recieve mail from outside of domain

==== Required information ====
- iRedMail version:
- Store mail accounts in which backend (LDAP/MySQL/PGSQL):
- Linux/BSD distribution name and version:
- Related log if you're reporting an issue:
======== Required information ====
- iRedMail version: 0.8.6
- Store mail accounts in which backend (LDAP/MySQL/PGSQL):  LDAP
- Linux/BSD distribution name and version: Debian 7.0
- Related log if you're reporting an issue:
====

We need to create a new email address that should only accept email from people outside of a domain. We do not want staff to send email to this address.

I can see that mailinglist have the ability to restrict people who can send to it but only restrict to domain users. We need the reverse of that i.e any sender that has the same domain as the list shold be rejected with a custom message telling them to send to a different address.

2

Re: create email address that can only recieve mail from outside of domain

We have a plugin for iRedAPD for per-user restrictions for OpenLDAP backend, check file /opt/iredapd/plugins/ldap_amavisd_block_blacklisted_senders.py on your iRedMail server please. You can reject senders based on domain name, but cannot reject with a custom message.

You can hack this plugin to achieve it, for example, line 60-62:

    # Reject blacklisted senders.
    if len(valid_amavisd_senders & blSenders) > 0:
        return 'REJECT Blacklisted'

Check whether recipient is the user you want to restrict, and reject with proper message:

    # Reject blacklisted senders.
    if len(valid_amavisd_senders & blSenders) > 0:
        if kwargs['recipient'] == 'YOUR_USER@DOMAIN':
            return 'REJECT Please send to another@domain.com instead'
        else:
            return 'REJECT Blacklisted'

3

Re: create email address that can only recieve mail from outside of domain

Thanks, I'll give that a try

4

Re: create email address that can only recieve mail from outside of domain

how would one apply this filtering to a mailinglist?

5

Re: create email address that can only recieve mail from outside of domain

We have 'access policy' for each mailing list, you can check /opt/iredapd/plugins/ldap_maillist_access_policy.py for more details.