Moving emails out of IMAP accounts to local folders without keeping copies on server

I have my Mail.app set up with multiple email accounts (from different providers).


For each of these accounts, I would like to make sure that when I drag an email *out* of the respective inbox into a custom “On my Mac” folder, that it gets deleted (or ends up in the IMAP Trash folder).

However, this only works for the iCloud account.

For Gmail accounts, as well as for other third party IMAP accounts, unfortunately, when I drag an email out of an inbox, it ends up in the IMAP "All Mail" folder (under “Archive”) and not in the Trash.


See the screenshot below of my setup:

Dragging a message from Inbox > iCloud into On My Mac > A Local Test Folder deletes the message from iCloud (it neither puts it into the Trash > iCloud nor into the Archive > iCloud folders – this is how I hope it would work in general).



Dragging a message from Inbox > Account A (which is a Gmail account, but with B, C, D it's the same) into On My Mac > A Local Test Folder moves the message into Archive > Account A (All Mail).


I would like it to be either moved into the Trash > Account A folder (so that it eventually gets deleted from the server), or to be deleted immediately.


Here’s a few things I have tried:

In the Gmail settings (in the browser) under Forwarding and POP/IMAP > IMAP access I changed the setting for "When I mark a message in IMAP as deleted:" from “Auto-Expunge on” to “Auto-Expunge off” and then changed the next option to “Move the message to the Trash” and, after that didn't work, to "Delete immediately".

Neither setting does seem to have any effect on the behavior in Mail. The message still appears under “Archive/All Mail”.


Then, in the Mail.app Preferences > Accounts > Mailbox Behaviors, for all Mailboxes (Drafts, Sent, Junk, Trash) I can choose if I want the IMAP or "On My Mac" version of the mailbox to be used. See the screenshot below illustrating this option for Trash:



However, for the Archive Mailbox there is no such option. I can only choose [Gmail]/All Mail.



For other accounts too, I can only choose the respective IMAP "Archive" folders here. Under no account does an On My Mac option appear.


So:

Essentially I'm looking for any of the following as possible solutions:

How to tweak Mailbox behaviors beyond the options shown

(a) make the default Archive mailbox use the "Gmail/Trash" folder or

(b) make it use the "On My Mac/Archive" folder or

(c) (ideally) some other "On My Mac" folder which I could then control.

Or alternatively, leave Mailbox behaviors as they are (as I also don't want to break anything else) and instead

(d) make sure that the action of dragging anything to an "On My Mac" folder is interpreted by Mail as "deleting" from IMAP.


Any help/suggestions for any of these (or maybe people have come up with other solutions too) would be greatly appreciated!



MacBook Pro 15", macOS 10.14

Posted on Apr 26, 2019 5:59 AM

Reply

Similar questions

11 replies

Apr 26, 2019 7:11 AM in response to jandavid

You are correct to go to the gmail site and fix the settings on how to handle mail when it is deleted from the inbox. As for the All Mail Folder, it shows messages for gmail no matter what mailbox they are in. Go to the label section at the gmail website and hide the All Mail Folder in IMAP (uncheck the box to Show in IMAP). That will remove the messages from the Archive mailbox which is where All Mail for gmail is shown now.


My server settings:


Apr 26, 2019 8:52 AM in response to jandavid

So, deleting works, but moving doesn't?

That makes sense in how Gmail works. Gmail doesn't have folders. It has Labels. Multiple labels can be applied to a message.

Gmail pretends to be IMAP which allows Mail to access Gmail. From an IMAP client like Mail, when you move a message, it sends a signal to Gmail to remove that label from the message. It cannot do anything about removing the other labels.

All messages enter Gmail and are tagged with both an Inbox label and an All Mail label. When you move out of the inbox, the Inbox label is removed, but the All Mail label remains. Mail can't send any signals to Gmail to "remove all labels."

Apr 26, 2019 11:09 AM in response to jandavid

Well those are the options. As I said, the settings I have won't send any to archive and nothing is left on the server. Use the 2 step to copy the messages first, then delete the messages. I suppose you could send them to the local trash in Mail settings which should remove them from all IMAP folders. And choose the setting to delete the message forever from the server. I hadn't tried that.


You could create a rule to move messages in Gmail to a local folder, then delete the message. That may save you from copying and deleting messages. Just depends on how you want to deal with them.

Apr 26, 2019 7:49 AM in response to jandavid

The settings I gave work just fine for me. I only show the Inbox, Sent, Drafts, Spam, and Trash in IMAP. I have enabled the settings in Mail as to when sent, trash and spam gets deleted. When trash is deleted completely from the Mac, it gets deleted from the Gmail server completely. This setting makes Gmail act the same for me as my ATT & iCloud account.

There is no reason that this shouldn't work the same for you.


You may need to go to the gmail site and clear out all the unwanted messages to start with and correct the settings. Restart Mail and try again.


As to other providers, you would have to deal with their server settings separately.



Apr 26, 2019 8:06 AM in response to jandavid

Hi, jandavid !


As the saying goes in the digital age : if you are not paying for the product, you are the product.


I would bet what you are experiencing is entirely intentional. Google, et al., cannot make money off that which doesn't exist. This is why I have stopped using all the "free" e-mail services save for iCloud.


In your situation I would just forward all GMail traffic to your iCloud account, and deal with the sorting, filtering, deleting, et cetera as you will.


Good luck !

Apr 26, 2019 10:45 AM in response to jandavid

Thanks so much to all for your suggestions!

I've read about the IMAP label/folder difference and figured out that "deleting" it from a folder in Mail (since "Inbox" for Gmail is also just a label) won't delete it from the server.


But I was still hoping that an action within the Mail app could send different signals to the server (like: if I move to "On My Mac" folders, tell the server to delete it). Which from a technical point of view should be possible, as I can do it manually in two steps (copying to a local folder and then hitting delete).

So Mail definitely can tell Gmail to delete a message.


And I thought the "Mailbox behaviors" preferences were precisely for that. Like for "Trash" I can choose the "On My Mac" trash for my Gmail account so that it will get deleted immediately and not sent to the server. I'm not quite understanding why that option doesn't exist for "Archive" (Apple clearly doesn't make money from leaving messages on Google's servers :) ... so one would hope they'd give us more options here ...)



Apr 26, 2019 7:27 AM in response to Glenn Leblanc

Hi Glenn,

Thanks so much for your reply.


Unfortunately, I tried what you suggest, but it doesn't change anything. Even with "Auto-Expunge off" and "move the message to the Trash" (or even "Immediately delete ...") the message still shows up in "All Mail".


As for hiding "All Mail" in IMAP, well, that hides it from Mail, sure, however, it doesn't remove the message. The point is to make sure the message doesn't remain on the server. The message still remains on the Gmail server (under "all mail") – if I check by logging in through the browser.


(I've only enabled All mail as an IMAP folder in order to quickly check from within Mail to see all that's remaining the server.)


So I need to find a way to have Mail send a message to the server to move it to trash or delete it when removed from the Inbox in IMAP.


BTW, the issue is not confined to Gmail, it also happens with other IMAP accounts, so I'm thinking it has to do with the Mail.app not with Gmail specifically.

The weird thing is that with my icloud email it works, i.e., all messages moved to "On My Mac" folders are deleted immediately.



Apr 26, 2019 8:28 AM in response to Glenn Leblanc

@Glenn

That's really bizarre.

Believe, me I have played around with all possible settings I'm aware of. As of now the Gmail account I'm experimenting with has no messages at all and to really figure out how it all works I'm sending individual messages to it from another account (not linked to Mail or anything else). They pop up in my Mail.app inbox and I've tried several things. The expunge settings in the Gmail Settings tab in the browser under IMAP don't seem to have any effect on the behavior. When I delete the email from the Inbox in Mail.app by hitting the delete key on my keyboard they get moved to the Gmail Trash folder (no matter what my expunge setting is). When I drag them out of the Inbox in the Mail.app to a local "On My Mac" folder they get "archived" i.e., get removed from Inbox but remain in All Mail.


Is there any other setting / configuration I'm missing?


Apr 26, 2019 8:40 AM in response to Buster_From_Oak_Park

@Buster_From_Oak_Park

Very true!

Yeah, I'm trying to figure this out precisely in order to get rid of my Gmail account eventually.

So yes, the end goal is to do some sort of forwarding as you say. But, I'm currently at the stage of trying to figure out how to get my emails off of Google's servers. And that proves (unsurprisingly) difficult. I could set it up as POP, of course, but I have numerous labels and things and I'd like to replicate the structure in Gmail locally, so that's why I've opted for IMAP. I had hoped I could then just drag the Gmail label folders that show up in IMAP to my local "On My Mac" folders to keep the archive there. So that didn't work and I was trying to figure out how the whole thing works. I'm going to spare you listing all the things I attempted before posting here, but to get the the most minimal setup I now just have an inbox with one message in it and am trying to make Mail.app tell the Gmail servers "delete it" when I move it to an "On My Mac".


I'm sure Gmail doesn't make it easy to extract my messages from their servers, but I was hoping I can configure Mail in some way to help me. Hence I'm curious why in the Mail preferences under "Mailbox Behavior" it prevents me from choosing a local folders for archiving.



Apr 26, 2019 8:57 AM in response to jandavid

Hi again, jandavid !


That behavior is not Apple's Mail - it's Google. Apple Mail can only do what the server tells it to do. Once you remove a message from the Google servers their revenue moves into negative territory. I am sure they make the process more difficult than it need be just for that reason alone.


You may have to recreate the structure after-the-fact, but I fail to see why setting the entirety of your GMail account to forward to iCloud would not be the solution. Once your email has been copied to the iCloud servers, you should be able to erase all the mail on the GMail servers. From that point on, it should be smooth sailing. Do exactly what you want to do.


Fun fact : nothing remains of the first IMAP protocol. No paper records, no software backups - nothing.


Fun fact II : Xerox was the company most responsible for creating/implementing the very first IMAP server. If any company would have been capable of photocopying and archiving documentation, wouldn't you think it would be Xerox?


:-)


Good luck !

This thread has been closed by the system or the community team. You may vote for any posts you find helpful, or search the Community for additional answers.

Moving emails out of IMAP accounts to local folders without keeping copies on server

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