For some reason (maybe stupid, probably it's about money) I need to setup domain to have two mail servers:

  1. some mail addresses would be on Google
  2. some mail addresses would be managed by our server

I know there is no way how to do it by MX records but is there any chance to get it working without several problems? Like (lets get domain.com):

  1. setup MX records of domain.com to google servers
  2. in google administration, create mail accounts that should be managed by google
  3. create domain aliases for others like ourserver@domain.com -> ourserver@f.domain.com
  4. setup MX records of f.domain.com to our server
  5. configure domain.com as mail domain on our server
  6. create user ourserver@domain.com
  7. create domain alias on ourserver that will f.domain.com -> domain.com
  8. lets that users to logging into system on ourserver and use our SMTP

Will this work? Has anybody better idea how to do it?

note: we are using postfix & dovecot combination on our server

  • Unless there's something clever you can do - in that current solution - users on your server will not be able to mail the users on the Google side. Your server will try and deliver the mail locally (knowing it's the target for domain.com) and then bounce it with unknown recipient. – EightBitTony Jul 25 '13 at 20:53
  • In Exchange this is called a shared SMTP namespace. Not sure if postfix/dovecot/google offer the same type of setup or not though. The term though might help with your search. – TheCleaner Jul 25 '13 at 20:56
  • @EightBitTony yeah, I've missed that... But that can have some solution, not? Would be stupid to create a second (reverse) alias like g.domain.com... – tomis Jul 25 '13 at 20:58
  • It should be possible, but not easy. Using masquerade_domains = domain.com in main.cf and using a g.domain.com subdomain with it's own mx record in dns. It's been a while since I set up a google mail domain and from memory they are a bit restrictive. – hookenz Jul 25 '13 at 21:12

There are two possibilities.

  1. Use a subdomain of domain.com for one of the servers.

    • e.g. gm.domain.com - for gmail.
    • and domain.com for your own server.
  2. Set up all users on your own server, and pull mail from your server through to gmail using POP. Of course, the gmail side will still need to be on a sub domain.

Not easy is it? Yes I think it would be possible but it won't be elegant to implement.

If email was to pass out from your own smtp server use the

masquarade_domains = domain.com

option in main.cf.

The only thing is I don't think gmail allows mail relaying. It would sure help to understand the driver for this. I'd ask them straight because it may not be entirely possible.

  • Would be nice but sent e-mails needs to be from domain.com - meaning that this is not acceptable. Next thing is that client have some paranoia and he don't trust anyone but google (why google?) so e-mails managed by google would be only managers ones... Thanks for apache/nginx (etc.) proxies and other technics, this is annoying (or clients are :-D ) – tomis Jul 25 '13 at 21:06
  • Basically I think all mail needs to go to your servers and be forwarded for certain users to google. Then google needs to do the masquerade. I don't think it's possible but I could be wrong. I don't have a google mail domain that I'm managing anymore to look at. – hookenz Jul 25 '13 at 21:22

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.