I'm working in a small company. We send our emails through company's mail server which is located (along with company's website) on a shared web host. Once in a while our Internet connection is down or the personnel have to wait a long time to upload their emails (with considerable size of attachments) to the mail server.

I would like to setup a local mail server and ask everyone to use this one instead. Then acting as a relay, this local mail server should relay emails to the one on the Internet (emails are always relayed to the same remote mail server). This way if our Internet connection is down, users can still send their emails to local mail server regardless and it's local mail server's responsibility to relay them once the connection is back up. And since it's a local mail server, it will take much less time for users to upload their attachments to it.

Here are my preferences / concerns (if possible):

  1. I would like not to register or assign a domain name (mycompany.com) or MX record for my local mail server. This mail server is not an open relay and its lonely responsibility is to connect to a singular remote mail server and I hope this requirement eliminates the necessity of a DNS.
  2. I've heard there are concerns regarding my emails to be labeled as spam if they are relayed this way. Which I definitely don't want it to happen.
  3. Perhaps one of most important points to make is security. What are the security issues in this scenario? And how should I tackle them?

So are my expectations reasonable? Can I do this? If yes I'll be really grateful if someone could direct me to the right path, what to read and how to do it.

ps. If it matters, I'm planning to use POSTFIX.


We run a local relaying email server (exim4) in our LAN, and it works fine. No DNS changes are needed. Two ways to do it:

  1. Configure all of the LAN email clients to use the local mail server. That might be feasible if, say, everyone is using a local webmail app, and you can just configure that. But if you have a bunch of diverse desktop clients it could be a lot of work. Or...

  2. Configure your LAN router to transparently redirect outgoing SMTP connections to the local mail server. Note that the destination port might be 25 (smtp), 465 (ssmtp), or 587 (submission).

For security issues, I can think of two:

  1. Of course you don't want your LAN email server accessible to the general internet. Be sure that your LAN firewall doesn't allow incoming connections on those three ports, and to be double sure, configure postfix to reject connections from outside of the LAN.

  2. Mail sent within the LAN could be delivered directly within the LAN, with no need to go through the upstream SMTP server. That's fast, but it would cut out any logging or security or antivirus scanning that the company server is doing.

I don't know any reason why this should cause outgoing messages to be flagged as spam. Spam traps can use whatever algorithm they want, but email commonly passes through multiple hops on the way to its destination. Your server would just be another hop. Maybe you heard that spam filters will flag messages coming through known open relays, but your server won't be that.

  • How would you configure Postfix to do so? Where can I read about it (what section of manual)? What is this technique called? And I think while the security issues you mentioned are valid but the ones to configure the remote mail server are more sever. I mean it has the higher risk of being spoiled since it is in the Internet and it should be configured to relay emails. – Mehran Jan 6 '14 at 10:45
  • One more thing, do you think it is doable with a shared hosting? – Mehran Jan 6 '14 at 10:47
  • Sorry, we use exim, I have no experience with Postfix. The technique is just called a local mail or SMTP relay I guess. The shared server needs to relay email, that's true, but only from one IP address. Ask your hosting provider if they can help. – Andrew Schulman Jan 6 '14 at 11:00

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.