How to Use Gmail over IMAP

I had a very simple idea yesterday to get Gmail to work through IMAP and wanted to share it in case it is of use to anyone else.

Warning: This is clearly not rocket science and I’m positive that thousands of people have already thought of this and are already doing it. It just didn’t occur to me until now.

The problem: I like mail applications better than web-based mail. I am especially not fond of the way Google’s threads work. I understand that this format works for some people… it just feels weird to me though. BUT… a Gmail account is great to have because of its free storage, spam filtering, separation from my own domain, and search capabilities. So very conveniently, Google enabled POP access to Gmail accounts several months ago. That’s great, except I don’t like POP either. It’s fine for people who only use one computer, but the second you begin using a multiple machines, it’s a synching nightmare.

Enter IMAP e-mail. With Dreamhost’s IMAP e-mail setup, I can maintain an unlimited number of e-mail accounts with over 20 gigs of storage space and keep it all automatically synched between as many computers as I want. Awesome.

The only problem is that while Gmail supports retrieving of e-mail via POP, they don’t via IMAP. So what can I do if I want to continue using my Gmail address for filling out forms on the web and benefit from its excellent spam/phishing filters? Easy! Set it to automatically forward to a special IMAP account! Since Gmail’s auto-forwarding feature leaves headers for the most part intact, I can now receive fully synched, fully intact copies of all my Gmail messages to any computer I happen to be on. Here’s how:

  1. Set up a new IMAP mailbox with your mail provider. The address could be “”… doesn’t matter. It’s not public-facing.
  2. Set your incoming mail server to its normal settings.
  3. Set your outgoing mail server to “”, check “Use SSL”, and use port 465.
  4. Go to Gmail’s POP/Forwarding settings panel.
  5. Turn on forwarding and forward to the special address you’ve set up.
  6. Set Gmail to archive your mail after forwarding.

That’s it. You’re done. Gmail over IMAP. That such an obvious solution has escaped me for this long is evidence of possible senility. Excuse me while I go stir my fiber drink.

72 comments on “How to Use Gmail over IMAP”. Leave your own?
  1. Sometimes the most obvious solutions are the sweetest

  2. Jeff Croft says:

    It’s a good idea, and it will probably work for a lot of people, but one word of caution: this requires double the disk space. You are effectively mirroring your G-mail on your current mail provider’s server. That’s fine if you have plenty of space on your mail provider’s server, but some people do not.

    On the plus side, you’re also making an unintended backup, which is nice. :)

  3. Mike Purvis says:

    I actually do the opposite of this: I have my non-gmail forward to my gmail, and then within Gmail, I have an “account” set up that lets my send outgoing mail from my non-gmail address.

    Of course, this is because a) I like my mail anywhere, b) Gmail kicks thunderbird’s ass in my opinion, and c) I don’t like being tied to a provider for the address itself.

    And yet I still have all that mail in my dreamhost mailbox, so it would be a snap to pick it up again using a desktop client; I just wouldn’t have my outbound mails.

  4. Josh Delsman says:

    I have the new Google Hosted method of using Gmail. Problem? I love having the secure webmail interface when I’m somewhere else (often), but I also like using! I wonder if this same technique could be applied to Hosted accounts.

    Mind you, it’s probably blatantly obvious, but it’s 12AM and I just got home from a concert, so.. :)

  5. Like Mike P., I do the opposite of what you described here. I send all my Dreamhost mail to Gmail for archiving and instant access when I can’t connect via Thunderbird or Mail. One thing that Mike said:

    I just wouldn’t have my outbound mails.

    This used to bug me, so now I have my desktop mail client include an automatic bcc: to my Gmail address for every sent email (with the + modifier to grab it, skip Inbox, and label as Sent).

    That said, I do like the idea of grabbing Gmail and bringing it down via IMAP…so thanks for the post!

  6. Rahul says:

    Hi Mike

    I use Fastmail to POP my Gmail account and have set up one personality in Fastmail as my gmail address, so I can send and receive my gmail mails from within Fastmail.



  7. allgood2 says:

    I’m not certain why this necessary. GMail has a POP option that keeps all mail on the server, so you can download it from as many different clients as you like and will still have access to it from the Google Mail servers, without forwarding. Then the only issue is sent mail; and I know for me, whenever I send mail through GMail from Eudora that message still gets listed under the sent mail in GMail.

    I can’t recall doing anything special to get that to get that to happen. It just did. In fact, I often forget that GMail is POP, because everything I’ve downloaded or sent through it (via the web or mail client) is always there. Once you activate the save copy item under the POP preferences, it pretty much acts as if its using IMAP instead of POP.

    The primary exception being folders/labels etc. But that’s fine for me, because typically if I download something into Eudora, I already have a slew of filters running on it. So I don’t want the same organization structure as I have for GMail.

  8. Mike D. says:

    Jeff: The POP option does the same thing (duplicates files and thus, disk space… but as you say, that’s not a bad thing).

    allgood2: The problem with the POP option is that either a) you have to redownload and re-“mark-as-read” all of your stuff, or b) you don’t get it at ALL on other POP clients after you’ve downloaded it once via POP. POP has no concept of server-side “mark as read”… only “has been downloaded”. IMAP does. That’s the big problem this method solves.

  9. Brian Fox says:

    I have Gmail forward my email to my normal IMAP account as well. One nice thing that Apple’s program has is the ability to add more than one email address into the “Email Address” field (comma seperated) and when I compose an email the “From field” is populated with my Gmail. Works out really well…. so I have 1 inbox that comes in, and can send from my various aliased email addresses.

  10. Todd Huss says:

    I have my GoDaddy registered domain forward to GMail which I then have spam filter and forward my mail to my imap account. That way Gmail serves as a backup for my email, does it’s great spam filtering, yet I still have my own email address and IMAP access:

  11. Dave Metcalf says:

    No one here seems to be paranoid about storing their emails on Google’s servers. Not that I am, but whenever Gmail comes up, someone always pipes up about some Google Total Information Awareness conspiracy theory.
    Do any of you current Gmail users have any concerns?

  12. Steven Herod says:

    I barely notice the adverts in gmail, but when i do it always crosses my mind ‘they are reading my mail aaaaaarrrgh!’

    I think the first time they demonstrate to me they are doing ‘bad’ with what they know about me is the day I cut all connections with them. But in the meantime, they have my clicks.

  13. Chris says:

    I am not as computer/programmer savy as many of you, so I’ve got a question about this method…what happens if you were to reply to an email through your mail application? I assume it would be from the address, and thus the email address would once again be left open for spam? Is this true? I suppose if you strictly used this for reading email then it would work perfectly.

  14. Chris: You have to set the address of that account as (not just the reply-to) in your email application. At least that’s how I did it in Apple’s Mail, and it worked fine. I’m no programmer either, but I guess since it’s going through Gmail’s out/SMTP server it never connects to or its server on the way out.

  15. Ted Pavlic says:

    Your experience with Google is that it has an awesome spam filter?

    Personally, I’ve stopped using Google because of all the spam it lets through. I use Google to backup all of my mail. If I were to use it to actually manage my mail, I would have to put other spam filters from other sites IN FRONT of it.

    I have paid for my own IMAP account elsewhere, and there all of my spam gets moved into spam filters. I have controls over Bayesian spam filtering on the server as well as the ability to add my own custom filters (whitelists and blacklists). With all of this, I get about one or two spam messages per month in my inbox. I never get false positives anymore.

    With Google mail, not only do I frequently get false positives, but I receive hundreds of spam in my inbox per WEEK. And I have spent a LOT of time attempting to train its filters. Personally, I don’t think the “Report Spam” button works.

    Google Mail still has a lot of work to do before I can call them serious about getting rid of spam.

  16. Timo Kuhn says:

    Josh: not sure this is what you are looking for, but i just wrote up a little article about that… you can check it out here:

  17. Mike D. says:

    Ted: When I refer to Gmail’s junk filter, the best thing I find that it does is filter out fake banking/credit card stuff. I route all my banking/cc stuff through Gmail and the fake stuff never gets through.

  18. Michael says:

    I have just a small question; what about trash message. it s disappear from gmail account when deleted in your imap application, in fact this method isn’t a real synch just auto forward ? is it ?

  19. Mike D. says:

    Michael: I have messages set to auto-archive as soon as they are forwarded to my IMAP account. I have no need to keep them in my Gmail inbox. The point of this message is to basically never have to use the Gmail interface.

  20. Peter F. says:

    Mike, don’t you like the Gmail interface?

  21. Mike D. says:

    Peter: Yeah, not such a big fan.

  22. blah says:

    my solution is similiar i guess…. i kinda like gmail’s interface it’s not always the fastest (they now host my domain email…)… i run my own email server co-lo’d at my work, i’m trying to get rid of doing this since my server crashed (mobo/cpu messed up)… but i use mdaemon for what’s left of the minority of my personal email basically its good for filtering… it has an option called multipop, which i pull my work email accounts in from, allows me to access them via imap my own dedicated server so its pretty fast almost all the time not saturated with users and disk grind like mainstream isp servers…

    anyways im going to probably start popping my gmail accounts since i dont see gmail offering imap anytime soon, i have a good 100 gigs of backup storage to play with at this point in time…that’s another solution besides forwarding to another account.

  23. Sebastian Padina says:

    I have forwarded my my Gmail account to my .Mac account just like you described above. One question though. It seems that when it comes to .Mac accounts you are not allowed to type in more than one address in the “email address” field in Mail’s preferences, so I cannot add my Gmail address. The only reason I would like to do this for is so that I can still send emails that appear to come from my Gmail. Not to mention, I actually have another email address that forwards straight to Gmail set up in school and it would be great if I could send with that address showing in the “from:” field. One way suggested was to add Gmail as a separate account, but that’s not an option as the damn thing wants an incoming server for every account and then goes and creates a special inbox for it. Any suggestions? Mind you, I don’t really care either way if I have to add Gmail’s smtp server or I can use .Mac, it’s the address that counts.


    P.S. Nice guide, I can’t believe it never hit me to do the same.

  24. Michael (H) says:

    what would be good… and a way to bypass the no-imap aspect (it will take more work) is to build a deamon/service based interpeter where you can point your client to your local computer… and then have it translate the gmail labels as your folders. This way you get the imap abilities… the google web interface will still work… and all is happy.

    no if only i could get the time to do this… Cocoa first then .NET ;-)

  25. Mike Cohen says:

    Not a good solution, since it removes your email from Gmail. I’d like to be able to keep my mail on Gmail, with its labels but just be able to access it in place via IMAP or the web interchangeably.

  26. Mike D. says:

    Mike: It does not remove your e-mail from Gmail. All mail is easily available/searchable in the archive.

  27. Tom B says:

    I want to access my Gmail from my Palm & from my Mac. I’ve got a .mac account a well. Are you saying I can have my gmail fwd’d to my .mac account? How do I set it up so I can POP dowm gmail to both my laptop and my palm? I’m a newbie to all this. Thanks.

  28. Mike Cohen says:

    Tom, I do the opposite, I forward my .Mac mail to Gmail so it can take advantage of Gmail’s spam filtering. .Mac’s spam filter is practically non-existant, so if I didn’t filter it through Gmail I’d be drowning in spam.

  29. Tom Davis says:

    On the contrary .Mac’s spam filter is very good at filtering out the basics. The main issue is that it’s not configuarable in any way and it’s especially bad at filtering out image-based spam…

  30. A python/twisted based IMAP interface to gmail.

  31. dananeer says:

    hi i need help guys
    i sent a mail to some open and need to recall it i mean get it back from his inbox before he open it
    can you help
    i’m using gmail

  32. mike says:

    I was wondering how easy that python/twisted app will be to use? I want a client like Thunderbird to synch up with my gmail labels and such. Does that do that? And how hard is it to get it to go? Thanks!

  33. Don says:

    Thank you so much for this tip. I can now access my gmail via my pda using IMAP.

  34. Kristian says:

    Sorry I don’t understand

    Set up a new IMAP mailbox with your mail provider. The address could be “”… doesn’t matter. It’s not public-facing.”

    Set up a new IMAP where? And what mail provider?

    *feels stupid*

  35. Kristian says:

    Ah, sorry. I need a DreamHost account ? :)

  36. Chris says:

    Kristian, be warned Dreamhost are really poor. Not only is the uptime dreadful, but the security of their mail servers is astonishingly bad – other users can trivially intercept your outgoing email to almost any domain.

  37. I highly recommend Tuffmail over Dreamhost for email. They even have a few features that will making doing what Mike is suggesting easier.

    With Tuffmail, I prefer to forward a copy of all incoming mail to GMail after I’ve done all my SPAM and list filtering. I also use Tuffmail’s SMTP servers and set my account to automatically BCC a copy of all outgoing mail to GMail.

    Using either my method or Mike’s, you don’t get a synchronized inbox between GMail and your IMAP clients, but I end up using Roundcube on Tuffmail for reading my current email anyway. I use GMail when I want to search through my old mail.

  38. Tuffmail has accounts that have very high quotas. IMAP supports labels, and the next versions of Roundcube and Thunderbird will also support labels. Soon you won’t need GMail: you’ll be able to have searchable, taggable email via an IMAP provider.

  39. Anonymous says:

    That’s some pretty sweet FUD you’re spreadin’ there, Chris. Unless I’m seriously mistaken, any email that’s not encrypted or transferred via SSL between the mailservers in question is just that: open to interception. True, I’m biased, but there’s a reason why I’m loyal to DreamHost: after lots of research, they’re the best value option around. They’re featureful, and the recent problems with uptime have been due to datacenter problems; at least they’re open enough to communicate with their customers via a well-written, funny blog, and are unfraid to articulate the exact technicalities of the problem. Some think that DH fans are bribed due to the availability of a referrer program, but so many online services have that nowadays it isn’t funny, and I don’t even personally participate in it: all DH links on my website are without referrer ID.

  40. sjk says:

    Unless I’m seriously mistaken, any email that’s not encrypted or transferred via SSL between the mailservers in question is just that: open to interception.

    Simply and bluntly, I’ve had enough experience and evidence prove to me that any data (especially unencrypted, of course) is potentially vulnerable to unsolicited examination. I’m not paranoid about it, just more consciously careful with sensitive data.

  41. PanMan says:

    I know, an old thread, but I still have some things that your proposed setup doesn’t solve: I would like to be able to keep using the Gmail web and especially phone interfaces, while syncing this to my Imap account (especially the “has been read” flag). I guess this is impossible, in the current setup, but perhaps someone smarter than me has thought of a way to do it?

  42. MSwanberg says:

    I am still looking for that perfect solution too. Blogged about it recently.

    I love the gmail interface, but my problem is the fact that many of my client sites block access to the gmail website.

    I have an IMAP server running at home, but like everyone else here, it doesn’t sync with gmail; it’s just a copy. So I still have to archive and mark-as-read in 2 places.

    I am thinking about just using the IMAP at home and maybe only using gmail as a backup. I would miss the gmail web interface sorely, but clearly sacrifices must be made.

  43. PanMan says:

    I would miss the Gmail interface. But I would REALLY miss the gmail j2me program, on my phone, which I really love…

  44. Hi there,

    I use Apple Mail and have just purchased a Fastmail plan to use with this method, but I can’t get the “Sent Items” to work properly. I can send and recieve fine, but the Sent items are not stored on the fastmail server and therefore do not appear in my folders.

    My settings are as follows:
    email address: my gmail account
    incoming server: the fastmail server
    outgoing server: the gmail server

    Draft don’t save either…

    Could someone kindly outline a step by step method with Fastmail and Apple Mail ?

    Thanks a lot in advance.

  45. Billy says:

    I understand about using Gmail’s SMTP server, so that when you send mail, it gets put on Gmail’s Sent folder. But what about when you send email using Gmail? How does this mail get to your IMAP account’s sent folder?

  46. Attila says:


    What kind of idea is that??
    This is not imap access to gmail!!!! I’s only mirroring. What about if you delete a message in your cllient”s inbox? Will it be deleted on gmail too? NO!!!
    So do NOT use the title “How to Use Gmail over IMAP” please!


  47. Mike D. says:

    Attila: I am using my Gmail account over IMAP. That is why this post is titled as such. If you read the actual post, you’ll see WHY I use Gmail in the first place and it is not for the same reasons as you. I *never* want to access it via the web interface.

  48. Max says:

    Has it dawned on anyone that the only reason Gmail will not offer IMAP is ….

    Well … ok … instead of charting the obvious … would Comcast allow you to skip commercials ? Recall they disabled that 30-sec skip button on their remote. Its like cutting your own neck.

    Google = Ad revenue … at least for now.

  49. Mike D. says:

    Max: No, because you can access it currently with POP. Has nothing to do with ads.

  50. Here’s another workaround. I like Gmail (actually use Google Apps right now) but occasionally I like to send desktop apps because I can click on an email address and it opens a new message. I thought I’d have to go back to the fwd to gmail method but there’s a really simple solution:

    Open email application – in this case Seamonkey, but Thunderbird is the same, and I believe Outlook does this too – and add an Identity. Specify the outgoing server address you mention above (works with Google Apps too) and that’s it. Works like a charm. Hopefully this works on Mail too.

  51. Justin Miller says:

    Have you considered using a flash drive with Thunderbird already installed on it? On, they have a bunch of apps you can install onto a flash drive, in essence taking all of your media with you. I’m actually using a portable version of FireFox to type this, and have another email account set up by IMAP in ThunderBird. You should look into it. Then you wouldn’t have to rely on POP servers so much.

  52. zak says:

    Nice tip. I’m confused on one thing though. What email address do you tell people to email you at? username@gmail or username@domainhost ? Since you are receiving mail from your domain host and sending mail thru google, which email address will the recipient see when they receive your email?

  53. Mike D. says:

    zak: the google part remains hidden… my public email address is at my domain

  54. zak says:


    What email address do you give people, your gmail or your domain email address?

  55. Mike D. says:

    Once again, I just answered that.

  56. zak says:


    In your previous comment, you say that gmail info is hidden, yet in the original instructions it states your domain email address is not public facing. This is whats confusing me.

  57. Mike D. says:

    zak: Ok, sorry for the confusion. For GMail over IMAP, I give people my Gmail address. I use it for buying online, signing up for web accounts, etc. Then, I just check the mail via IMAP so I never need to use Gmail’s interface.

    For Gmail FILTERING of IMAP domain-based mail (which is another procedure altogether), I forward all domain-based mail through Gmail, and then back to IMAP again. In that scenario, the public domain-based address is used.

  58. Kanny says:

    Some mail servers (e.g. my office one) don’t support POP and only works with IMAP. I want my Gmail to work like Thunderbird to access that account and delete spam messages. Is there a way for this ?

  59. Randy says:

    Great idea, but I’m having a problem. When I send an email using Mac Mail, using Gmail’s servers, the sent mail shows up on Gmails servers (seen via the web) but not in any of the Sent Items, or Sent, folders in Mac Mail. How do I get the messages to show up there?


  60. Josh says:

    Don’t know if this’d help, but I wrote recently about how to use Gmail and Fastmail and ChatterEmail to create “push email” on a Palm Treo running on Palm OS:

  61. Tommy says:

    Google is currently implementing FREE IMAP for its users… some users have it and some do not but within a week or two everyone should now have it. ROCK ON!

  62. […] Cela fait maintenant un bon bout de temps que cette fonctionnalité est réclamée… Des solutions alternatives ont été proposées et une pétition a même circulé pour que Google ajoute la fonctionnalité. […]

  63. […] ziet er naar uit dat de mannen van Google eindelijk IMAP gaan aanbieden aan GMail gebruikers. Iedereen die weet wat IMAP is, juicht nu de pannen van […]

  64. This is a workaround rather than an actual solution to the problem of “using gmail over IMAP”. Your non-gmail account is “synced” only when new email arrives, but it does not work when you erase messages or move them in folders (the equivalent of gmail’s labels). Plus not quite all ISPs provide as much space as Google (I have 4455 MB of mailbox space in my Gmail account at the time of writing). By using this you’re simply bailing out all the benefits of using gmail (except spam filtering perhaps). If you are gonna go this way why use a gmail account in the first place?

  65. Mike D. says:

    Giannis: Because to me, there are only two benefits to using Gmail —

    1. The spam filtering.
    2. An email address that is completely separate from my domain.

    That’s it. There’s nothing else that is beneficial to me. This method preserves both.

    This thread became obsolete as of last week though because Gmail now allows you to use IMAP to connect to their servers.

  66. […] while it seems like everyone else seems to already have it, I’m still stuck in the dark ages here. I’ve waited for more […]

  67. leny says:

    Here is what i did.
    Just make a new temporary email address they already come with IMAP/ Forward your real email to this new temp address-you can even delete as email arrive and are forwarded /in your iphone settings, on your Outgoing mail server put your real email address.
    You don’t even have to notified any email changes since it would seem that you are sending from the real one.
    .sheers.Google IMAP

  68. Grindlay says:

    IMAP is now available in GMail.
    In settings > General > Select “English US”

  69. Marc says:

    You don’t like Gmail’s conversation view? The best thing to happen to email and you don’t like it! Would you rather prefer emails titled Re: …. flooding your inbox?

  70. […] (however, it is handy to set up IMAP access to non-work email addresses – and there is a hack for Gmail – if you want to manage your email from work), but Thunderbird is also an excellent RSS […]

Leave a Reply

Your email address will not be published. Required fields are marked *

Subscribe by Email

... or use RSS