MX Config with Google Apps + Local forwarding via Postfix

Related to another post on postfix errors, I am trying to determine if the following config is possible.

I have a domain, example.com, that currently uses google apps to handle mail for the small dev team working on the site. The DNS entries for the mail are as follows:

ASPMX.L.GOOGLE.COM      10 
ALT1.ASPMX.L.GOOGLE.COM     20
ALT2.ASPMX.L.GOOGLE.COM     20
ASPMX2.GOOGLEMAIL.COM     30 
ASPMX3.GOOGLEMAIL.COM     30 
ASPMX4.GOOGLEMAIL.COM     30 
ASPMX5.GOOGLEMAIL.COM     30

Now, we have a business requirement to allow users to have a temporary email account (xyzuser@example.com) that, via postfix, will forward mail sent to xyzuser@example.com to their own email account. The forwards need to be set-up via PHP, which is why we are thinking of using a locally installed postfix server and command-line php.

So, basic question: is it even possible to have some mail handled by one server (google), and some by another (local)? The quick answer is yes, but I would imagine not with the same domain name, correct? ie I could setup an mx record to send all @example.com email to google, and an mx record to send all @mail.example.com traffic to linode…

A mail neophyte just trying to get my head around this configuration…

Thanks for any help/pointers/criticism.

Paul

3 Replies

@pmmenneg:

I could setup an mx record to send all @example.com email to google, and an mx record to send all @mail.example.com traffic to linode…
This is the best way, and the one I'd recommend. Google Apps allows you to forward addresses, too, but I doubt that will help you in this case. They have a limit on the number of mailboxes you can set up, depending on how much money you throw at them.

In a nutshell, it's not possible if you do this:

@ IN MX 10 aspmx.l.google.com.
/* ...etc */

However, you can do this, quite easily:

@    IN MX 10 my.linode.com.
corp IN MX 10 aspmx.l.google.com.

Or this (your original idea):

@    IN MX 10 aspmx.l.google.com.
mail IN MX 10 my.linode.com.

Google Apps can be nudged to accept a domain alias like "corp.mydomain.com" in its management, allowing your users to have @mydomain.com and you guys to have @corp.mydomain.com or whatever. That's how I'd do it.

My thoughts without trying it, anyway.

One thing I am also looking into, using Google Apps to do it all.

The Premier edition has a 'Provisioning API' that allows creation of groups. A public single member group can easily be used to forward email as we need. Groups are not analogous to users in that they don't require storage, authentication, etc.

Have a question in to Google on the restrictions on groups, in terms of how many you are permitted to create with any given account. As we will be creating a new 'forwarding' group for each user, and if we are successful there will be thousands of users, we need to see if we will be bumping up against any cap. Each group can have 2000 emails sent to it a day, which we will be nowhere close to.

This would be the perfect solution, rather than rolling our own… will post an update when I hear back from Google!

So it turns out there is a limit of how many 'forwarders' or google groups as their know, even with a premium account. This limit is 30 per paid user, so this won't work for our solutions. Here is what I tried to do since I found out using Google wouldn't be a perfect solution:

  • Configured Postfix + Dovecot on linode

  • Via PHP, create and manage the temporary virtual aliases

  • Temporary accounts get forwarded to users via virtual aliases

  • Permanent corporate accounts go into virtual mailboxes

  • POP3+IMAP access to corporate accounts via Dovecot

OK, so what I was hoping to do was to cut over the primary mx from google apps to my own server, and then still use the google apps interface to access the mail via POP3… which is possible, until you try to add a pop3 account to google apps that is the same account as the google apps account, which isn't that surprising I guess. Was trying to have it all, a single email solution (use hosting it) while not losing the powerful and collaborative google apps interface…

So now we have a tough decision I think (unless anyone else can see another way):

1) Host everything for @example.com, stop using google apps for email (we would keep it for docs, etc, but the email interface is so great…)

2) Keep primary @example.com email with google apps, and use a sub-domain @e.example.com or somesuch, for the throw-away forwarders.

From a marketing perspective, it looks better having everything @example.com vs subdomains I think, but I'd love to pass on having to worry about managing email accounts, etc vs the simple forwarding setup.

Again, any opinions welcome!

P

Reply

Please enter an answer
Tips:

You can mention users to notify them: @username

You can use Markdown to format your question. For more examples see the Markdown Cheatsheet.

> I’m a blockquote.

I’m a blockquote.

[I'm a link] (https://www.google.com)

I'm a link

**I am bold** I am bold

*I am italicized* I am italicized

Community Code of Conduct