Looks like no one’s replied in a while. To start the conversation again, simply ask a new question.

Moved message is still in folder but hidden (using Gmail IMAP)

I have an Applescript that adds an Omnifocus task based on an email in one folder, then moves the message to another... when this happens in Mail the message in the original folder is no longer there and is moved to the new folder, and the task is added to Omnifocus. I run this every 5 minutes. It all seems to be working.


Until the next 5 minutes that is... then the task is added again. Applescript thinks the message is still in the original folder.


So I checked GMail and the message IS still in there! The message in GMail still has the original label (the folder in Mail) AND the new label (the folder it is moved to). But it is not showing in the old folder in mail.


So the task is added again every 5 minutes.


Does anyone know why Mail does this, i.e. makes me think the email is moved (not appearing in the folder) but it actually is in the folder? It messes up the Applescript.


Thanks a lot

iMac, Mac OS X (10.7.3)

Posted on Oct 21, 2012 12:20 PM

Reply
3 replies

Oct 23, 2012 3:12 AM in response to amityweb

I may have fixed this inadvertently...


GMail basically do not use IMAP folders like other providers, due to their labelling system I believe. So making Mail.app work with GMail is a bit of a problem, there are many posts about this.


As part of my effort to make Mail work with Gmail I have hidden the All Mail folder in Gmail and then use the Archive feature in Mail.app. This creates another IMAP folder called Archive. So in effect my new Archive folder in Mail (which is a label in GMail) is my new All Mail box with only mail I want in Archive (as opposed to GMail keeping some rubbish emails in its All Mail which I do not want to see).


Anyway, since using this Archive box in Mail and hiding All Mail, I am not longer seeing these duplicate tasks in Omnifocus. The Mail no longer has the old label in GMail when Mail moves it to the new folder.


So maybe the issues was due to GMails IMAP folder setup, and having the All Mail box there, but I cannot know for sure. Maybe its because with All Mail showing the email in Mail will be in All Mail AND in my custom folder than Omnifocus scans. So maybe when Mail moves it, due to the other copy being in All Mail, which is what GMail attaches the label to, it keeps the old label. But without All Mail, my message is only in Mail once, in the folder I put it in. So moving it actually moves it. I dont know though, just a guess!

Oct 24, 2012 1:37 PM in response to amityweb

Spoke too soon, its still got the issue. It just does not do it all the time.


So basically the issue is when using AppleScript to Move a message into another folder (and using GMail IMAP, so Labels in GMail), the original label in GMail is kept even though Mail does not show the mail in this folder. But Applescript still thinks the mail IS in this original folder (i.e. it sees the GMail label assigned to the message, even though the message is not in the Mail folder).


Hope that makes sense.

Oct 25, 2012 8:23 AM in response to amityweb

I think the problem is solved, discussion on another site here:

http://forums.macrumors.com/showthread.php?p=16133518#post16133518


Needed to select the destination folder the message was moved to to update GMail label and Mail and therefore remove the message from the sourcfe folder in Mail and prevent it from adding to OF again. Full Applescript on the link too.

Moved message is still in folder but hidden (using Gmail IMAP)

Welcome to Apple Support Community
A forum where Apple customers help each other with their products. Get started with your Apple ID.