Appletell | Apple, Mac, iPhone, iPod | News, Rumors, Reviews, How-Tos

Dabbledoo Media Gadgetell Gamertell Appletell
Subscribe to our content for free: (?)
Get our Daily Email

Quick Fix for Gmail IMAP-Mail Issues

by Mark Rowland on Apr 13, 2008 at 08:37 AM

GmailFor those of you who use Gmail IMAP in Mail as I do, you are probably just as annoyed with one thing- the new messages counter always reads twice the actual number.  This is because the message is sent to both your inbox and the folder titled “Gmail” or “All Mail”.  Just put the following into Script Editor, and voila!

tell application “Mail”
  set unreadBox to mailbox “[Gmail]/All Mail” of account “Gmail IMAP”
  set unreadCount to unread count of unreadBox
  if unreadCount is not 0 then
    repeat unreadCount times
      set unreadMail to first message of unreadBox whose read status is false
      set read status of unreadMail to true
    end repeat
  end if
end tell

Before running this script, you may have to type in the following in script editor in order to get the official name of your account:

tell the application “Mail”
  get accounts
end tell

Once you have done this, change “[Gmail]/All Mail” to the name of the folder as it appears in Mail. Then, change “Google IMAP” to the official name of your account.  This should do it!

Comment with any questions or if you have any suggestions for a more efficient script, do tell.

Keep up with the latest gadget goodness! - Subscribe to our feed



Comments
  • Dude.  Mail.app is not the one to blame for the email appear both in the Inbox and the Gmail/All folder.  The “All” folder in Gmail contains all your mail ( Sent, Deteled, Forwards, Inbox etc ).  Writing this script is an exercise in futility.

    Google mentions this here:

    http://gmail.google.com/support/bin/static.py?page=troubleshooter.cs&problem=bugflow&selected=bugflow_imap08

  • Avatar for Mark Rowland

    I’m not blaming either Google or Mail.app for the issue, I’m simply putting out a way to remedy it.

  • Alex Blewitt said:

    1) This was nicked from MacOSX hints
    2) It’s a stupid idea there, too. If you mark your ‘all mail’ read, then it will have the effect of automatically marking all mail as read in other inboxes as well, so the next time it synchronizes it will pick up the changes and mark all mail read from other folders too.

    The solution is to mark your inbox as your inbox, and then the new message count shows what’s new in the inbox. If you don’t do that, it shows all unread messages in all folders.

  • Josh said:

    You can also handle this with Mail rules.  I have one that moves all my sent mail to my Sent Mail folder and marks it read.

  • Page 1 of 1 Comment Pages
Join the Discussion

Name: *

Email: *

Location (Links to Google Maps):

URL:

Enter Your Comment Below...

* Required fields

Remember my information?

Notify me of follow-up comments?

Submit the word you see below:


Special Features