Submit Hint Search The Forums LinksStatsPollsHeadlinesRSS
14,000 hints and counting!

A better Gmail IMAP to Mail.app sync Apps
This workaround fixes many of the problems reported all over about the inconsistencies syncing Gmail IMAP with Mail.app. It keeps your inbox and sidebar nice and clean with proper mail counts. All other Gmail behaviors (trash vs. archive) remain the same.

Within Gmail.com's web interface, make the following labels (Mail.app treats labels as folders):
  • IMAP/Sent
  • IMAP/Trash
Then, within Mail.app's Accounts Preferences, on the Mailbox Behaviors tab, check/set these things:
  1. Uncheck "Store draft messages on the server." (I noticed that Gmail.com erroneously keeps several incremental copies of each message and later deletes them, so I just disabled this option to avoid the problem altogether.)
  2. Check "Store sent messages on the server" and select your deletion interval -- mine is set to one week.
  3. Uncheck "Store junk messages on the server."
  4. Check "Move deleted messages to the Trash mailbox."
  5. Check "Store deleted messages on the server" and select your deletion interval -- mine is one week.
Then, on the Advanced tab, set IMAP Path Prefix: IMAP -- this relates to the labels you made earlier. Finally, in the sidebar (gacked from this post):
  1. Highlight IMAP/Sent in the sidebar and select Mailbox » Use This Mailbox For » Sent.
  2. Highlight IMAP/Trash in the sidebar and select Mailbox » Use This Mailbox For » Trash.
This workaround does make temporary duplicates of every message you sent and/or deleted, but they only remain duplicates for as long as you set your deletion interval above. I have not noticed any problems using this method so far, especially with correct mail counts and the possibility of deleting one message from Mail.app that deletes the whole thread in Gmail.com.
    •    
  • Currently 2.83 / 5
  You rated: 3 / 5 (40 votes cast)
 
[200,209 views]  

A better Gmail IMAP to Mail.app sync | 43 comments | Create New Account
Click here to return to the 'A better Gmail IMAP to Mail.app sync' hint
The following comments are owned by whoever posted them. This site is not responsible for what they say.
A better Gmail IMAP to Mail.app sync
Authored by: Apple Guy on Apr 17, '08 07:49:30AM

This worked great!! I love how it cleaned up the sidebar. Thank you for this great tip!!!!!!

---
Have you jailbroken your iPod touch or iPhone yet? If not visit my site to find out how! http://www.imackid.net



[ Reply to This | # ]
A better Gmail IMAP to Mail.app sync
Authored by: matt.simerson on Apr 17, '08 08:41:40AM

this hint is a winner! I think I might *finally* be pleased with gmail imap.



[ Reply to This | # ]
A better Gmail IMAP to Mail.app sync
Authored by: parraccourci on Apr 17, '08 09:03:36AM

You can also support spam by doing this:

in gmail:

add a new label:
IMAP/Junck

add a new filter:
- Has the words: "is:spam" (w/o quotes)
- Next Step >>
- Apply the Labal "IMAP/Junck"


Within Mail.app's Accounts Preferences, on the Mailbox Behaviors tab, check/set these things:
- Check "Store junk messages on the server."


Highlight IMAP/Junck in the sidebar and select Mailbox » Use This Mailbox For » Spam.



[ Reply to This | # ]
A better Gmail IMAP to Mail.app sync
Authored by: ikioi on Apr 17, '08 09:56:42AM

I tried this, but Gmail doesn't actually show any of those messages in the IMAP/Junk folder. If I go to the gmail web interface and look at the Junk folder, I see all of the emails and see that they all have the IMAP/Junk label, but if I go to the IMAP/Junk label itself, it shows up empty. Any ideas for how to get around this? FWIW, I'm using Google Apps with my own domain, so if it works in regular Gmail, then this may just be a difference in behavior between regular gmail and the Google Apps version of Gmail.



[ Reply to This | # ]
A better Gmail IMAP to Mail.app sync
Authored by: rawhead on Apr 17, '08 10:43:54PM

I would also like to know how to get Junk/Spam syncing to work. Your method doesn't (at least, not for me).

I need this because Gmail spam filter is awesome, but not 100%, and will sometimes gobble up important e-mail. I need to check it fairly frequently, and it's a pain to have to use the web interface (especially since I have 3 Gmail addresses that receive important e-mail).

---
All these moments will be lost in time
Like tears in rain.
Time to die.



[ Reply to This | # ]
A better Gmail IMAP to Mail.app sync
Authored by: minorio on May 25, '08 08:52:55AM
It's NOT "is:spam". It could be "in:spam".

I hope this function.

Reference (Using advanced search)
http://mail.google.com/support/bin/answer.py?answer=7190

[ Reply to This | # ]
A better Gmail IMAP to Mail.app sync
Authored by: kevlong on Apr 17, '08 09:25:01AM

Sorry to be dim but what where did the labels/folders that used to appear in the sidebar go?

Kevlong



[ Reply to This | # ]
A better Gmail IMAP to Mail.app sync
Authored by: Anonymous on Apr 17, '08 09:38:58AM

Yes, that's the problem.

They haven't gone anywhere, they just don't appear anymore because of the path prefix being set to IMAP.



[ Reply to This | # ]
A better Gmail IMAP to Mail.app sync
Authored by: GeeMan on Apr 17, '08 10:33:54AM

I've configured this, but I need to have my other folders visible in Mail.app (would have been nice if the OP mentioned that they would disappear after this mod, but there you go...). How do I undo what I've just done? Can I just delete the two IMAP folders I created and remove the IMAP path prefix in Mail prefs?



[ Reply to This | # ]
A better Gmail IMAP to Mail.app sync
Authored by: ravidew on Apr 17, '08 10:41:05AM

Yes, just walk backwards through the instructions to undo.

You can also make your previous "folders" visible again by prepending "IMAP/" to the start of all your existing labels.



[ Reply to This | # ]
A better Gmail IMAP to Mail.app sync
Authored by: hodgjy on Apr 18, '08 09:22:17AM

Sorry about the confusion. I mistakingly omitted the fact that previous sidebar folders would be hidden. I guess I figured since it was obvious to me, it would be obvious to everyone. It appears you figured it out, though.



[ Reply to This | # ]
A better Gmail IMAP to Mail.app sync
Authored by: ravidew on Apr 17, '08 10:40:06AM

Yes, just walk backwards through the instructions to undo.

You can also make your previous "folders" visible again by prepending "IMAP/" to the start of all your existing labels.



[ Reply to This | # ]
Helps sidebar, but not sync
Authored by: ptone on Apr 17, '08 10:51:11AM

This is a great tip and helps clean up the sidebar. But so far I haven't seen it solve the issue I have with sync, where mail.app fails to promptly download new mail messages.

I have Google notifier installed, and get notice of new messages sometimes minutes-an hour before mail.app fetches it. Quiting and relaunching mail always seems to work. IDLE setting doesn't seem to matter. Not sure if this is a mail.app or a gmail issue...

-P



[ Reply to This | # ]
Helps sidebar, but not sync
Authored by: hodgjy on Apr 18, '08 09:11:16AM

I've noticed that IDLE commands from Mail.app don't work with many mail servers. They have failed with every mail server I've tried. So, in my opinion, this is a Mail.app problem and not a Gmail problem. I've turned off IDLE commands and set my check for mail interval to 5 mins. I get every message and I also get the new mail notification sound (which is apparently hit or miss in Leopard's Mail.app).



[ Reply to This | # ]
You may lose archiving this way
Authored by: googoo on Apr 17, '08 11:56:47AM
One of the things I really like about Gmail is the ability to archive E-mail, and it looks like you will lose some of the archiving functionality with these settings (although there is a workaround). What you have to remember about Gmail IMAP is that it functions differently than standard IMAP. In Gmail, an E-mail message has labels, which translate to folders in Mail.app (or other IMAP clients). The real difference between Gmail and standard IMAP is that a message can have multiple labels. That means the same message will appear in multiple folders in Mail.app. When you delete a message in Mail.app, Gmail removes the label representing your current folder from that message. If the message still has other labels, it remains in those folders.

The [Gmail]/All Mail folder is special. All messages reside in it, except for messages in [Gmail]/Trash or [Gmail]/Spam. Deleting a message from [Gmail]/All Mail does nothing. It will show up again next time Mail.app syncs the folder with Gmail.

How do you delete a message? Move it into the [Gmail]/Trash folder. Messages deleted from within this folder are immediately deleted. Otherwise they will be deleted automatically in 30 days. (The [Gmail]/Spam folder functions similarly.)

The IMAP settings suggested by Gmail work well with this non-standard IMAP behavior. When you delete a message from your Inbox, it is still archived in [Gmail]/All Mail. That way, your Inbox remains clean and messages are archived by default. That works for me!

-Mark

[ Reply to This | # ]

Gmail suggestion
Authored by: chris_on_hints on Apr 17, '08 11:53:21PM

if you follow these suggestions, you seem unable to delete anything (Mail in Leopard). Unchecking the "Move deleted messages to the Trash mailbox" item stopped me being able to delete things.

i guess this is because to actually delete an email, you need to add the 'Trash' label to it, by moving it to that folder.



[ Reply to This | # ]
Gmail suggestion
Authored by: googoo on Apr 18, '08 06:48:49AM

That is correct. If you use these suggestions you delete something by moving it into the [Gmail]/Trash folder.

-Mark



[ Reply to This | # ]
Gmail suggestion
Authored by: hodgjy on Apr 18, '08 09:19:40AM

Sorry about the confusion. I never permanently delete messages in Gmail (part of the attraction of Gmail), so I never mapped the Gmail Trash folder in Mail.app. You are right and it seems like you figured it out.



[ Reply to This | # ]
You may lose archiving this way
Authored by: hodgjy on Apr 18, '08 09:14:07AM

You don't lose archiving. Every message that is ever sent or deleted remains in Gmail's "All Mail" folder. The duplicates in IMAP/Sent and IMAP/Trash are removed, but the originals remain in All Mail. You do lose the ability to drag a message from a folder to Gmail's Trash folder to permanently delete it from within Mail.app, but this doesn't affect me. I don't delete any messages, which is part of the allure of Gmail. YMMV.



[ Reply to This | # ]
You may lose archiving this way
Authored by: kvdv on Apr 19, '08 12:11:15PM
Mark, There's something confusing about the things you're saying:
The [Gmail]/All Mail folder is special. All messages reside in it, except for messages in [Gmail]/Trash or [Gmail]/Spam. Deleting a message from [Gmail]/All Mail does nothing. It will show up again next time Mail.app syncs the folder with Gmail.
How do you delete a message? Move it into the [Gmail]/Trash folder. Messages deleted from within this folder are immediately deleted.
When you delete a message from your Inbox, it is still archived in [Gmail]/All Mail. That way, your Inbox remains clean and messages are archived by default. That works for me!

So, if i delete a message (using the delete key on my keyboard), the message goes to where? The Gmail trash? And it will be deleted after 30 days, right? But if i move it to the GmailTrash folder it will be deleted immediately? That's strange.
But...even stranger... you say that when i "delete a message from my Inbox, the Inbox remains clean while the message remains archived in GmailAll Mails". That's confusing, because you also wrote : "All messages reside in All Mail, except for messages in [Gmail]/Trash".
So, if i just deleted a message from the Inbox, that means it's going to the trash and it won't reside in All Mail? So then it's not archived after all?
-Kris

[ Reply to This | # ]
You may lose archiving this way (not!)
Authored by: googoo on Apr 21, '08 10:51:09AM

Sorry my post was not clear. To answer Kris' questions, when you delete a message from Gmail using your delete key in Mail.app, the Gmail removes that label (folder) association from that message. For example, when you delete a message from your Inbox, it is removed from the Inbox, but it still appears in the other labels (folders) in which it previously resided. There are three exceptions: [Gmail]/All Mail, [Gmail]/Trash, and [Gmail]/Spam. All messages in your Gmail account that are NOT in [Gmail]/Trash or [Gmail]/Spam are also in [Gmail]/All Mail. When you delete a message from [Gmail]/All Mail, it reappears in [Gmail]/All Mail when Mail.app syncs with Gmail. When you delete a message from [Gmail]/Trash or [Gmail]/Spam, it is permanently deleted. Gmail automatically deletes messages that have been in [Gmail]/Trash and [Gmail]/Spam after 30 days. How do you remove a message from [Gmail]/All Mail? By moving it into [Gmail]/Trash or [Gmail]/Spam. (Of course, you can configure Mail.app to do just that when you delete a message, but you really would lose archiving that way.)

I misunderstood the configuration represented in the original post. Since that configuration sets up an alternate trash folder IMAP/Trash, it does not behave like [Gmail]/Trash. When Mail.app deletes the trashed messages inside that folder, they remain in [Gmail]/All Mail. Archiving is preserved!

Does that answer your questions?

-Mark



[ Reply to This | # ]
A better Gmail IMAP to Mail.app sync
Authored by: jaysoffian on Apr 17, '08 02:36:42PM

I'm quite sure with these settings that messages will never be deleted. Here's why:

When you "delete" a message in Mail.app, it moves it to the IMAP/Trash folder. In the Gmail web interface, this corresponds to removing the Inbox label and applying the IMAP/Trash label.

Mail.app will then cleanup (delete) any messages that have been in the IMAP/Trash "folder" for more than one week. In the Gmail web interface, this will correspond to removing the IMAP/Trash label. At this point, any such messages are unlabled, but they have not been deleted. They'll still remain archived and will show up if you look for them in "All Mail" in the Gmail web interface.

This may be what you desire, but I thought it should be mentioned explicitly.

BTW, the issue with duplicate drafts is not a Gmail problem. I've see it with other IMAP servers (both Courier and Dovecot), so I think it's just a Mail.app quirk with storing drafts on an IMAP server.

j.



[ Reply to This | # ]
A better Gmail IMAP to Mail.app sync
Authored by: googoo on Apr 18, '08 06:55:49AM

I think you are right. In order to make these settings work like a normal IMAP server (which seems to be what the hint author intended), you must set Mail.app's trash folder to [Gmail]/Trash. If an IMAP client (i.e., Mail.app) deletes something in the [Gmail]/Trash folder, it gets deleted from the server. If Mail.app deletes a message from any other folder (except [Gmail]/Spam), the "deleted" message would still be in [Gmail]/All Mail.

-Mark



[ Reply to This | # ]
A better Gmail IMAP to Mail.app sync
Authored by: hypert on Apr 18, '08 11:46:46AM

I'm afraid I'm a little confused. A picture would be a worth a thousand words here.

What's wrong with everyone's Gmail/Mail IMAP? I followed the "use this mailbox for" hints that have been around for a while, and now I have an integrated Inbox, Drafts, Sent Items, and Trash (OK, I don't check the Trash, but I think it's working like the others).

Down at the bottom of the Mail sidebar, I do have a GMail folder, but I leave it collapsed and just ignore it. All my Gmail mail is in my "regular" folders, so it's easy to ignore.

What is this hint trying to solve?



[ Reply to This | # ]
A better Gmail IMAP to Mail.app sync
Authored by: hodgjy on Apr 18, '08 12:30:21PM

There is an issue with wrong new mail counts--especially because when you read a message in the inbox, it still appears unread in the All Mail box. So, you have two counts that Mail.app can't figure out.



[ Reply to This | # ]
A better Gmail IMAP to Mail.app sync
Authored by: vivekv80 on Apr 18, '08 04:27:00PM

I have setup IMAP on my iPhone for my Gmail account. Now I am also using my school account on my Gmail account. I have seen that when I reply to emails that are in my school_emails_label; the sender address defaults to my gmail a/c and not my school a/c.
Is there a turn around for this using the iPhone??



[ Reply to This | # ]
A better Gmail IMAP to Mail.app sync
Authored by: thelamecamel on Apr 19, '08 07:19:11PM

If you just want that crap out of the mail sidebar and you don't care about storing sent/trash on the server, then it seems you can just set the IMAP Path Prefix in mail to IMAP (or any other string that doesn't match a GMail folder or label).



[ Reply to This | # ]
A better Gmail IMAP to Mail.app sync
Authored by: schvenk on Apr 21, '08 09:24:53AM

Is Gmail IMAP relatively stable at this point? I tried moving my email from my ISP over to Gmail IMAP a while back and discovered it wasn't ready for prime time - copying large mailboxes over via IMAP resulted in a fair amount of data loss. Gmail help pretty much said, "Don't copy your mail over, it's not stable enough." So I gave up. Has this improved?



[ Reply to This | # ]
A better Gmail IMAP to Mail.app sync
Authored by: nixlimited on Apr 22, '08 10:09:32AM

Maybe I don't understand the behavior with this change, but I have some issues. The sent mail (in Mail.app) no longer syncs with gmail's sent mail--it only has the mail I have sent since making the change. Complicating that problem, I now have a whole hoard of emails in gmails web client with the IMAP/Sent label applied--it's an eyesore.

The cleaned up sidebar, though, is a fantastic development. I had always been annoyed by those folders and the inconsistencies between new email counts.



[ Reply to This | # ]
A better Gmail IMAP to Mail.app sync
Authored by: minorio on May 25, '08 09:00:43AM

The sent mail (in Mail.app) goes into under the label of IMAP/Sent on Gmail. It means that.
But this way, you can find your sent mail (in Mail.app) on Gmail web, which is good.



[ Reply to This | # ]
A better Gmail IMAP to Mail.app sync
Authored by: asmeurer on May 12, '08 09:12:50PM

This seems like a lot of work. Maybe I will just wait for Apple Mail to support GMail labels directly. I don't really need folders anyway.



[ Reply to This | # ]
A better Gmail IMAP to Mail.app sync
Authored by: minorio on May 25, '08 08:48:27AM
It's NOT "is:spam". It could be "in:spam".

I hope this function.

Reference (Using advanced search)
http://mail.google.com/support/bin/answer.py?answer=7190


[ Reply to This | # ]
A better Gmail IMAP to Mail.app sync
Authored by: minorio on May 25, '08 08:51:41AM

Sorry, I posted it to the wrong place in this thread. :-p



[ Reply to This | # ]
A better Gmail IMAP to Mail.app sync
Authored by: switters on Jun 11, '08 04:59:23PM

Okay, I tried this and I now have an inbox, trash and sent mail folder with ZERO emails in it.

I followed the steps exactly. The sidebar did change as anticipated, but when I click on Inbox, Trash or Sent there is nothing in any of the mailboxes.

Anyone know what might be going on?



[ Reply to This | # ]
How to set up Apple Mail for better Gmail IMAP support
Authored by: luciddesign on Jul 21, '08 03:17:26PM
Take a look at this article, http://luciddesign.co.nz/2008/7/21/how-to-set-up-apple-mail-for-better-gmail-imap-support, for a better way to set up Apple Mail with Google Apps or Gmail and IMAP.

[ Reply to This | # ]
A better Gmail IMAP to Mail.app sync
Authored by: anthlover on Oct 26, '08 01:15:15PM

Have you tried adding into the mix the just released Google Labs Advanced Imap Settings that lets you do things like Hide ALL MAIL Label/Folder.

Also what is the logic of only keeping a week of Sent Items if you want to maintain the history.

I have tried the hints main underlying premise before and found it flaky, many many months ago. I have tried the new wrinkles added to the hint and google labs add on Advance Imap settings and things seem to be about as peachy as they can get. There is still some oddity, delays in sync etc. but at least everything shows up in one place.



[ Reply to This | # ]
A better Gmail IMAP to Mail.app sync
Authored by: slferris on May 15, '09 09:26:08AM

Thank you for this timely hint.

Just wondering if you have found a way to show in Mail.app items that Gmail has flagged as junk or spam.

One of the comments to your hint suggests a way to do this, but it doesn't seem to work for me. It mentions setting up a label called IMAP/Junck, etc.

Thanks



[ Reply to This | # ]
A better Gmail IMAP to Mail.app sync
Authored by: mk12 on Oct 03, '09 06:34:42PM

I confirm that messages that you delete from trash (or get deleted after a week) are archived in all mail, which you can view by going to the gmail web interface. Thanks so much, I looked everywhere to find this!



[ Reply to This | # ]
A better Gmail IMAP to Mail.app sync
Authored by: ScottNYC on Jan 15, '10 02:57:17PM

Im having related issues does anyone have answers to any of these question?

Question 1:

how do you make messages sent to trash in apple mail, go to trash in gmail and not go to "all mail"?

Question 2:

I followed the instructions mentioned in a goole help article titled "recommended IMAP client settings" found here http://mail.google.com/support/bin/answer.py?hl=en&answer=78892#
after I changed the settings to that of the article, these labels appeared:

what are these labels? why were they created?
-deleted messages
-drafts
-sent messages

pic can be seen here, last 3 folders : http://www.flickr.com/photos/39468387@N05/4277558196/

Why are there now 3 sent message sections,
2 draft message sections,
a trash and deleted section in apple mail client? How do they relate to each other?

Question3:

After these settings were changed, Some mail goes straight to trash, skipping the inbox, why is that happening, which setting changed that? (I have 1 filter configured to send all spam right to trash if that helps). Before I changed the settings to match the article, messages marked spam still went to inbox, now they don't.


Question 4:

can someone explain the settings in mail>preferences>accounts>mailbox behaviors ? pic can be seen here: http://www.flickr.com/photos/39468387@N05/4277558174/

-store draft messages on the server
-store sent messages on the server
-store junk messages on the server
-move deleted messages to the trash mailbox


how do these affect the communication between apple mail and gmail? (configured using IMAP)

Answers to any of these questions would be greatly appreciated. I've been struggling to get a hold on my gmail account for months, but trying to stay organized is becoming difficult when messages are being placed in unknown areas/labels/folders and when Im unaware of how apple mail and gmail work in conjunction. Im trying to understand how to make apple mail and gmail behave the way I want them too. Thanks!



[ Reply to This | # ]
A better Gmail IMAP to Mail.app sync
Authored by: melodrama on Jan 16, '10 01:39:51AM

See this article for a full explanation of how gmail and Mail.app interact:
http://db.tidbits.com/article/10253



[ Reply to This | # ]
A better Gmail IMAP to Mail.app sync
Authored by: herojig on Mar 28, '10 06:24:01AM

This is a fantastic tip for cleaning up the sidebar, but like so many other users, i still don't get any mail...the gear just spins and incoming messages is stuck at 1 of xxx. thx anyway however:)
jigs



[ Reply to This | # ]
A better Gmail IMAP to Mail.app sync
Authored by: jjmarcus on Apr 13, '10 10:59:11AM

I have found similar instructions recently, and used them successfully, but I have a couple of tweaks to suggest:

1) Google recommends (http://mail.google.com/support/bin/answer.py?answer=78892#) that you leave "Store sent messages on server" OFF. This works for me; if you are using smtp.gmail.com as your outgoing server, messages will automatically go into your Sent folder.

2) I do not like setting a path prefix (Some people like to set it to "Gmail"). In my experience, it cuts off access to my other Gmail labels/folders.

3) I leave the Trash mailbox alone, but I do click on my /Gmail/Drafts folder and set "Use this mailbox for: Drafts".

4) If you have already been using your Gmail account in Mail, using the "Use this mailbox for" option will delete your existing local folders such as "Sent" and "Drafts" -- AND the messages therein. So I make sure to have a backup of each of those.



[ Reply to This | # ]
A better Gmail IMAP to Mail.app sync
Authored by: beausmith on May 09, '10 12:25:07AM
Undo steps: (from: Undoing "Use this Mailbox for..." with Gmail/IMAP on Apple Discussion board.)
  1. Look at Mail > Preferences.
  2. See that edit had caused the Mailbox Behaviors > Store Sent Messages on the Server preference to become checked (it was previously unchecked).
  3. uncheck it and the folders reverted to how they were before.


[ Reply to This | # ]