HOWTO: Custom Domains with MobileMe on the iPhone via Postfix

Posted by – July 27, 2008

MobileMe Box

It is hard to change the email address your email is coming from when sending email from MobileMe on the iPhone because it will not let you simply change it in settings, like it does from other IMAP accounts. I really wanted to use MobileMe, mainly for the push email and contact/calendar/bookmark synchronization. However, if it did not allow me to keep my current email address at my own domain it was going to be a deal breaker. Luckily, I found a way to still use my existing email address with the iPhone. In order to do this you will need:

  • Create an alias with MobileMe
  • Modify Postfix configuration
  • Forward your email to the new MobileMe alias
  • Modify MobileMe account on iPhone to use your Postfix SMTP server

First create an alias with MobileMe, this will be used by your mail server to forward mail to you. For example you could pick username.incoming@me.com. This is needed because we are going to ask Postfix to map your main MobileMe address to your existing one.

Next lets modify the Postfix configuration. For this we are going to use the email address joe@domain.com as our existing email address and assume the postfix configuration files are located in /etc/postfix. First lets create /etc/postfix/smtpgenericmaps with the following content:

username@me.com joe@domain.com

Then edit /etc/postfix/main.cf and add:

# SMTP Outbound From Rewrite
smtp_generic_maps = hash:/etc/postfix/smtp_generic_maps

This will cause any outbound email delivered via SMTP that have a from address of username@me.com to be rewritten as if they came from joe@domain.com. You will need to reload/restart postfix for this change to take effect.

Forward your mail to username.incoming@me.com. On my mail server we are using virtual domain maps, so I updated my virtual alias maps to forward my mail to username.incoming@me.com. You could also do the same thing by using a .forward file or procmail/maildrop. Note: Do not forward to username@me.com, it will cause a loop, do to the smtpgenericmaps and send a NDR to the sender of the email.

Lastly we need to modify the MobileMe account on the iPhone to use the Postfix as the outbound SMTP server. To do this goto Settings -> Mail, Contacts, Calendars -> Your MobileMe Account -> Account Information -> SMTP -> Add or Select your SMTP server.

There you have it! Now when you send an email from your iPhone it will appear to be sent from joe@domain.com rather than username@me.com.

  • R. Zane Rutledge

    Andy: Excuse my ignorance of all things mail and geeky. I’m just trying to find a solution for getting my standard, good ole email address “pushed” to my iPhone, and be able to have my replies show up as that same custom email domain. (It would be nice to also take advantage of the whole MobileMe syncronization between iPhone/webmail/Mail.app as well, I suppose.)

    Is you postfix solution above only available if you’re running your own mail server? I assume that is probably the case. If my mail account is hosted somewhere, this solution won’t work, right? I can forward (redirect) my emails all day, but I don’t think I can “restart postfix” or such things on my hosted account.

    Silly that there isn’t an option to use anything other than the @me.com address… We should at least be able to override the “From” field (like many services allow). I guess I’ll send Apple a dirty email and hope MobileMe 2.0 evolves. (If you have any suggestions, please let me know.)

  • http://www.securedgenetworks.com Wireless Internet

    With allot of the online marketing and internet things you need to do, you definitely need to set up an alias email, just to be able to sort out emails from one topic to the next and also keep your personal information secured.