Koozali.org: home of the SME Server

Block email to outside Domains

Offline fastxl

  • **
  • 32
  • +0/-0
Block email to outside Domains
« on: April 09, 2015, 08:03:16 PM »
I have SME Server 8 that I am setting up as an "internal" email server for just our office. I have it working, but I need to be able to block any emails going to and other Domain. Example if some tries to email joe.smith@yahoo.com or steve@hotmail.com I would like that email returned. How can I accomplish this?

Thanks,
Eric

Offline janet

  • *****
  • 4,812
  • +0/-0
Re: Block email to outside Domains
« Reply #1 on: April 09, 2015, 08:42:27 PM »
fastxl

I have not tested this, but you could put a fake non existant mail server address in the server manager Email panel for the ISP's SMTP server
eg mail.fakesmtpserver.org (assuming that does not exist).

I expect local mail will be delivered but external mail will not be able to be sent as there is no specified external SMTP server available.

Please search before asking, an answer may already exist.
The Search & other links to useful information are at top of Forum.

Offline fastxl

  • **
  • 32
  • +0/-0
Re: Block email to outside Domains
« Reply #2 on: April 09, 2015, 08:49:46 PM »
Seems to work perfect. So simple. Thanks for the fast reply.

Eric

Offline Stefano

  • *
  • 10,894
  • +3/-0
Re: Block email to outside Domains
« Reply #3 on: April 09, 2015, 09:07:59 PM »
be sure to block outgoing traffic to tcp 25/465/587


Offline fastxl

  • **
  • 32
  • +0/-0
Re: Block email to outside Domains
« Reply #4 on: May 08, 2015, 01:56:26 PM »
I need to revisit this subject. I was able to block sending email from all users to people outside the domain by adding a "Fake" ISP mail server. Now it seems I am going to need some of my users to have their email "forwarded" to an outside email address. Any ideas on how I can make this happen?

Thanks,
Eric

Offline CharlieBrady

  • *
  • 6,918
  • +3/-0
Re: Block email to outside Domains
« Reply #5 on: May 09, 2015, 06:33:47 AM »
Any ideas on how I can make this happen?

Custom template for /var/qmail/control/smtproutes to send the particular outside domain to a particular smtp server.

Offline fastxl

  • **
  • 32
  • +0/-0
Re: Block email to outside Domains
« Reply #6 on: May 11, 2015, 03:46:16 PM »
Charlie,
Thanks for the direction. Here is what I plan to do.

mkdir –p /etc/e-smith/templates-custom/var/qmail/control

nano smtproutes

mail-to-domain.com:relay-mail-server.com
:fake.mail.server.com

signal-event email-update

Am I correct that all mail to “mail-to-domain.com” will be forwarded to “relay-mail-server.com? And all else will be returned because it is a “dummy” server? Can I narrow it down to a specific user? Can I have a line in the smtproutes file like john.doe@mail-to-domain.com:relay-mail-server.com?

Thanks,
Eric

Offline CharlieBrady

  • *
  • 6,918
  • +3/-0
Re: Block email to outside Domains
« Reply #7 on: May 11, 2015, 03:55:45 PM »
Can I have a line in the smtproutes file like john.doe@mail-to-domain.com:relay-mail-server.com?

No.

http://www.qmail.org/man/man8/qmail-remote.html