I've tried the search and read and tried quite a few articles by now and still no luck, so I'm hoping someone can help me here.

My situation is: I'm running a web server in our local network that is ofcourse also accessible from the web and is running a few domains on it. I have a dns server in our local network so we could access the domains hosted in our server with the domain name.

But for now all our emailing is done and hosted on another server outside of our network.

Lets say the web server is responding to a domain name domain.com and the problem is, that when domain.com is trying to send a email to info@domain.com it doesn't deliver to the mail server but gets stuck in ours. All emails get sent for outside domains like gmail.com.

Now I've tried setting mx records in our dns server to point to the correct email servers. I also tried clearing mydestination in /etc/postfix/main.cf but no dice

The server is Ubuntu server 12.04 and using Postfix for email.

Hope someone can help me here :)

Best regards,


  • Needs some clarification. It sounds like you're saying the mail server is provided by mail.A.com, the webserver address is domain1.com, and the webserver is trying to send mail to info@domain1.com, which you expect it to send over to mail.A.com for delivery to your mailboxes. What is the hostname on the webserver? If it is domain1.com, change it to something else and retry. – Andrew Domaszek May 22 '14 at 19:44
  • Hi, thanks for your response. It's unclear to me what exactly hostname does in the configuration so yes, the hostname is the same as the domain name at the end of the email address, Is it possible to route it somehow without changing host name? – Alari May 23 '14 at 11:09

Sounds like the real problem is that your local web server can't send email...and this is by design per:

"all our emailing is done and hosted on another server outside of our network."

That comment implies that you only send email using your external mail server. Any reason why you aren't allowing your local server to send mail?

If you are using an email client you can configure the receiving server in your client using the local server and the smtp server in your client using the external server. I've currently got a customer with a subset of employees that want Exchange but the rest do not. So half the company needs to use a different email server than the other half, which means I can't change the MX record for the company's primary domain.

I set them up with hosted Exchange using subdomain.domain.com, created the MX and autodiscover records in just their office for subdomain.domain.com and then set the reply-to IP address for their email accounts to domain.com.

Each user's Outlook is configured to use the Exchange server first, then the POP 3 server 2nd and to pull email down from the hosted POP3 mail server every 5 minutes. External incoming email takes this silly route from hosted POP 3, to Outlook then to Exchange. Outgoing email is sent directly from Exchange.

Some hosting providers will support SDR(Split Domain Routing) which is supposed to handle this for you.

  • I'll have to write in two comments: Hi, thank you for your input. I'll elaborate a bit. The webserver is allowed to send emails and the websites php scripts do that when contact forms are used for example or for reminders and such. But then the email is sent to an email address of the same domain name it won't get to the destination. – Alari May 23 '14 at 7:47
  • (contact form on domain.com sends the email to info@domain.com but since the hostname of the server itself also contains domain.com it looks no further, but the email for info@domain.com should be sent to veebimajutus servers) What I meant by "all email done on another server" is that i'm buying email hosting service from a hosting company veebimajutus.ee and our domain mx records point there Best regards, Alari – Alari May 23 '14 at 7:48

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.