Using Claws Mail with Gmail
FIRST: In your gmail settings, turn on "enable less secure app access". (Gmail's "enable less secure app access" is a euphemism for "apps that don't support OAUTH2", it does not mean programs, such as Claws Mail, are less secure.)
NOTE: This is an article taken from Profarius. This article outlines some important aspects and tips of using Claws with your Gmail account.
NOTE 2: For a small portion of Gmail accounts made between 2005 and 2012 all instances of "[Gmail]" in this document should instead be replaced with "[Google Mail]". To determine which is to be used, after you add a new Gmail account in Claws-Mail and the remote folders are fetched, you will see the sub-directory named either "[Gmail]" or "[Google Mail]". Whichever you see is the one you should use for the entirety of this tutorial, including the tags (i.e. labels) you create from within the Gmail website.
[... Snipped Text - View original to read...]
Gmail handles email with tags and not folders. This is really the point of this blog. Your mail client will recognize these tags as folders, but Gmail doesn't handle them as such. This can make things pretty interesting.
To start, make sure you archive all of your email. Anything in Trash will be deleted after 30 days. Login to your Gmail account via your browser. Now we need to make some tags (i.e. labels) that our mail client will use. Make sure you prefix all tags with [Gmail]/. You'll see why later. At a minimum, you need to have
- [Gmail]/Queue, and
I also have a few others such as
- [Gmail]/Ubuntu, and
The last three are personal tags that represent folders I want to have available.
If any [Imap]/ tags exist, delete them. They're ugly and useless. You may need to delete them after doing all of this too.
When it comes to a mail client, I use Claws Mail. It's the only client I've found with the features required to do this. You will need to setup your connection to Gmail the same as as anything else. In order to be able to do this at all, you'll need to log into your account, go to "Settings > Forwarding and POP/IMAP" click "Enable IMAP" and click "Save". This will allow you to access your account with claws-mail.
After you've set up the basics in claws-mail, you will see your standard Inbox, Sent, Trash, etc. You will also see a [Gmail] directory with all the tags you created underneath it.
Isn't that just ugly? Everything in a sub directory... Ya, let's fix that.
Go to Configuration > Edit Accounts. Select your account and click Edit. Check out the Receive section. In this section you will see an "IMAP server directory". In this area you will add "[Gmail]" (w/o quotes of course). Now right-click your account name in Claws' main window and select "Rebuild folder tree". This will get rid of the [Gmail] directory and all your tags will show up as directories at the root level. This is already MUCH nicer to look at.
We don't want to stop there, but for now. Click Apply, OK, Close. Right click the Account name in your folder list, this is the account name and should show (IMAP4) beside it. From the right click menu, select "Rebuild folder tree". This will make things easier to look at.
You have a "Sent Mail" folder and a "Sent" folder. "Sent Mail" is created by Gmail and this is the one we want to copy sent mail to. Right click "Sent Mail" and click Properties. Across from "Folder Type" select "Outbox" and click Apply, OK. You can now delete the "Sent" folder as it no longer matters. You will now use the Gmail's "Sent Mail" instead.
You also have an "Archived" folder and a "Trash" folder. You will set your client to move deleted items here later. If Right click "Archived" and click Properties. Set the Folder type to "Trash". Click Apply, OK. This will make sure when you delete something, it's marked as read. The actual directory it goes to when deleted is handled down this page.
Go back to your account properties. Configuration > Edit Accounts | Account | Edit. This time, go to the Advanced section. You will see a box titled Folder. This is a big deal with what we're doing. Check all four boxes. Click the Browse button and select the appropriate folder. ~!Read this word for word!~ You want to make sure everything is filed with a [Gmail]/ tag. Sent messages should be going into the "Sent Mail" folder that Gmail uses. Deleted messages should be going in the Archived folder you created with the tag.
By sending mail to Archived, we avoid Google's 30 day Trash deletion nuisance.
Here is a sample of what I have:
- Put sent messages in: #imap/Profarius/[Gmail]/Sent Mail
- Put queued messages in: #imap/Profarius/[Gmail]/Queue
- Put draft messages in: #imap/Profarius/[Gmail]/Drafts
- Put deleted messages in: #imap/Profarius/[Gmail]/Archived
Note that Profarius is the name of the account. It will be whatever you named yours. The rest should be identical. Make sure the [Gmail]/ part exists in EVERY line.
When you delete something, it will instead be archived. No need to worry about automatic deletion. If you really do decide you have email you want to delete, you can drag it to the Trash. After 30 days, if you haven't realized you really do need that message, it will be gone. This avoids that "holy crap I needed that" problem.
It's possible that you have two "Trash" folders. If this is the case, it's because claws-mail created one and Gmail created one. Just drop a test email into one and check your Trash on Gmail. If the message is there, delete the other Trash folder and move your test message back wherever you want it. If it doesn't show up, then repeat the process with the other directory, just to make sure.
The last step is to subscribe to ONLY the folders you care about. Right click the account name, go to Subscriptions, click Subscribe, check Search recursively, click Search. You can use this process to subscribe to specific or all folders. My personal preference it to subscribe to all and specifically unsubscribe from what I don't want.
I find Spam useless because I don't want to see spam. I find Starred useless because I don't ever flag messages. I have [Gmail]/Saved to save important messages. Of course if you flag messages, you could use this. One folder that you may as well not bother with is "All Mail" because it's just a duplication of everything else, including what you're keeping in Archived.
I've tried to do this setup under other mail clients, but they don't seem to have the features and flexibility required to do this.
You should now have your mail client working perfectly and beautifully using Google's 'tag your email instead of sort it' approach. This is the exact approach I took to host my email on Google using my domain. It took me about 15hr to finish tweaking things to make it work just perfect and I didn't figure out the last little piece until I was writing this. Overall, I'm very happy with the result and I do feel the hassle was worth the reward.
Of course, if you're going to have over 7GB of email, you will need to split things between multiple user accounts or stick with your own server. You can use this exact same process To have Archived on one account, Inbox on another, etc. You just can't apply multiple tags.
I hope this helps someone out there!