2

I am looking for a mail solution (or server) that work only inside an office and only employees inside the office can send and receive the email from each other. I don't want the employee to send email to the outside world even if they try to send email to abc[at]gmail.com, etc.

In brief, I want to set up a mail server in my office (for 60+ employees) with a local domain name (say aman.local) and each employee will have their own email address (e.g. emp1@aman.local, emp2@aman.local, etc) on aman.local domain. And the employees will communicate with each other using the above email addresses. Here, the mail server should only process email with aman.local domain name and reject processing of other domain names (like gmail.com, etc) to restrict remote email sending.

So far I tried the following things:

I know I can restrict the incoming email by skipping the MX config.

  1. hMailServer, Poste.io, and Mailu.com but didn't find a way to restrict remote email sending (say to gmail.com, etc)
  2. Tried to find a way in Roundcude Webmail client to reject sending to email other than the allowed domain name. But all in vain.

Thanks in Advance. :)

Aman
  • 23

1 Answers1

0

You can do at least two things:

  1. Use postfix and restrict the domains of senders and recipients as it is described here

Restrict Sender and Recipient

This section describes how to restrict both the sender and recipient. Example usage of this is when you have a private domain which should not be allowed to send to the internet. Edit main.cf1. Edit the file /etc/postfix/main.cf and add the lines below.

smtpd_recipient_restrictions =    check_sender_access 
hash:/etc/postfix/sender_access,   reject_unauth_destinations

smtpd_restriction_classes = local_only 
local_only = check_recipient_access 
hash:/etc/postfix/local_domains,    reject

Edit sender_access

  1. Create the file /etc/postfix/sender_access and review the example below.
acme.local  local_only

Edit local_domains

  1. Create the file /etc/postfix/local_domains and review the example below.
acme.local  OK

Edit sender_access

  1. Type in the command belows in a terminal window to create the hash files.
postmap /etc/postfix/sender_access 
postmap /etc/postfix/local_domains
  1. The other way is to set your firewall to reject all incomming and outgoing communications via ports 25, 465 and 587
Romeo Ninov
  • 7,848