MozillaZine

Using Gmail with Thunderbird and Mozilla Suite

From MozillaZine Knowledge Base

These instructions were written for Thunderbird but also apply to the Mozilla Suite. The main difference is that Tools -> Account Settings is replaced by Edit -> Mail & Newsgroup Account Settings.

Gmail supports webmail, POP, and IMAP accounts. They all access the same mailbox. Gmail also provides a SMTP server that you can use to send messages. To add an account in Thunderbird you need to add either a POP or IMAP account, enable it in Gmail using a browser, and then configure the account to use the SMTP server.

If you want to read your messages offline its frequently better to use a POP account rather than a IMAP account. IMAP stores messages in remote folders. You can configure a IMAP account to mirror folders locally using Tools -> Account Settings -> Offline & Disk Space -> "Select folders for offline use" but its more suitable for advanced users.

Gmail is rebranded as Google Mail in Germany, Austria and the United Kingdom.

Contents

Add a POP account

If you don't have a Gmail POP account:

  • Open Thunderbird, go to "Tools -> Account Settings", click the "Add Account" button, select "Gmail" and click "Next".
  • Enter your name in the "Your Name:" field, and enter your entire Gmail address (yourname@gmail.com) in the "Email Address:" field. Click the "Next" button.
  • Press the "Finish" button.

If you already have a Gmail POP account and want to add another:

  • Open Thunderbird, go to "Tools -> Account Settings", click the "Add Account" button, select "Email Account" and click "Next".
  • Enter your name in the "Your Name:" field, and enter your entire Gmail address (yourname@gmail.com) in the "Email Address:" field. Click the "Next" button.
  • Select "POP" as the account type and enter pop.gmail.com in the "Incoming Server" field. If you don't want your Gmail messages to be stored in Local Folders, unselect "Use Global Inbox (Store Mail in Local Folders)". If it can use your default SMTP server it will tell you what SMTP server its using. If it doesn't or you want to use Gmail's SMTP server enter smtp.gmail.com in "Outgoing Server". Click the "Next" button.
  • Enter your entire Gmail address (yourname@gmail.com) in both the "Incoming User Name:" field and the "Outgoing User Name:" field. Click the "Next" button.
  • Enter a name (such as "Gmail") for your Gmail account in the "Account Name:" field, click the "Next" button and then the "Finish" button. There will now be a new account showing in "Account Settings" called "Gmail" or whatever you named it.
  • Select Server Settings from the folder list below your new account.
  • Change "Port" to 995.
  • Find the Security Settings section and select SSL.
  • Check the checkbox for "Check for new messages at startup" and "Automatically download new messages".

Add a IMAP account

Gmail recently added support for IMAP accounts. If you already have a Gmail POP account with the same username save any messages you have downloaded to Local Folders and delete the POP account using Tools -> Account Settings -> Remove Account. You'll still be able to access any messages that you had stored on Gmail's mail server, you'll just be using IMAP instead of POP.

The new accounts wizard lists Gmail as one of the choices. However, that was implemented before Gmail added IMAP support so it only supports POP accounts. The is a bug report requesting they add support for IMAP. In the interim you could either try the Gmail IMAP Account Setup addon or use the following instructions, which use the generic email support in the new accounts wizard.

  • Open Thunderbird, go to "Tools -> Account Settings", click the "Add Account" button, select "Email Account" and click "Next".
  • Enter your name in the "Your Name:" field, and enter your entire Gmail address (yourname@gmail.com) in the "Email Address:" field. Click the "Next" button.
  • Select "IMAP" as the account type and enter imap.gmail.com in the "Incoming Server" field. Click the "Next" button. If you already have a account and it can use your default SMTP server it will tell you what SMTP server its using. Otherwise enter smtp.gmail.com in "Outgoing Server" and click "Next".
  • Enter your entire Gmail address (yourname@gmail.com) in both the "Incoming User Name:" field and the "Outgoing User Name:" field. Click the "Next" button.
  • Enter a name (such as "Gmail") for your Gmail account in the "Account Name:" field, click the "Next" button and then the "Finish" button. There will now be new account showing in "Account Settings" called "Gmail" or whatever you named it.
  • Select Server Settings from the folder list below your new account.
  • Change "Port" to 993.
  • Find the Security Settings section and select SSL.
  • Check the checkbox for "Check for new messages at startup". Don't check the one for "Check for new messages every X minutes". Gmail supports the IMAP IDLE command. This means the IMAP server automatically notifies the email client when there is new mail (if you're still logged in), there is no need to poll for new mail.
  • Select the "Advanced" button.
  • Enter "[Gmail]" (without the quotes) in "IMAP server directory". This works around a bug in how it displays the folders. The case matters, it won't work if you use a lower case 'g' for example. Note: if you are using GoogleMail enter "[Google Mail]" instead.
  • Press the "OK" button.

Enable the account

  • Log into your Gmail account using a browser.
  • If you're using a POP account click on "Settings -> Forwarding and POP/IMAP -> POP Download:" and choose either "Enable POP for all mail (even mail that's already been downloaded)" or "Enable POP only for mail that arrives from now on". (Either option you choose that fits your needs will work here.)
  • If you're using a IMAP account click on "Settings -> Forwarding and POP/IMAP ->Enable IMAP"
  • Click the "Save Changes" button.

Add a SMTP server

You can skip this step if you're using the default SMTP server.

  • Still in "Account Settings", click on "Server Settings" (under "Gmail" in the left panel) and select the checkbox for "Use Secure Connection (SSL)". Optionally, also select the checkbox for "Check for new messages every 10 minutes". Don't select anything else.
  • Next, click on "Outgoing Server (SMTP)" in the left panel (you may need to scroll down), click the "Advanced" button and click the "Add" button.
  • In the "Server Name" field write smtp.gmail.com. The "Use name and password" box must be selected. In the "User Name" field enter your entire Gmail address (yourname@gmail.com). Under "Use Secure Connection" select TLS. After selecting TLS, the port number will automatically change from 25 to 587. This is correct! Now click "OK" and "OK" again.
  • Go back to "Server Settings" under "Gmail", click the "Advanced" button and then the "SMTP" tab. In the "Server" field drop-down select the last one. Normally it will be smtp.gmail.com:587. Click the "POP" tab and select "Inbox for this server's account". Click the "OK" button. Close Thunderbird and restart the application.

Send a test message

  • Try to send and receive e-mail messages in Thunderbird using the Gmail account. Thunderbird will ask for your Gmail password twice, once when you send, then again when you receive e-mail. You should enter the password correctly both times when prompted. If desired, select "Use Password Manager to remember this password" so that it won't ask for your password the next time you send and receive e-mail. To protect your privacy, you can instead leave the "Use Password Manager to remember this password" un-checked if someone other than yourself may have access to your e-mail client.
  • You're done.

Disposable addresses

Gmail supports plus-addressing, a useful way to create a disposable email address. Lets say your email address is JohnSmith@gmail.com and you need to give the xyzzy web site a email address. If you give them JohnSmith+xyzzy@gmail.com it will still be delivered to your inbox, despite the To: header having an extra "+xyzzy". If somebody starts sending spam to that email address you could create a message filter that tests for xyzzy in the To: header and automatically delete (or move to the Junk mail folder) those messages when checking for new mail. Some email systems violate RFC 2822 and won't send a message using plus addressing, but its normally not a problem.

Mail fetcher

Gmail supports a way to periodically fetch email from up to five POP accounts and merge them into your inbox. The POP accounts could be provided by Gmail or another email provider. It works with Thunderbird but you have to configure mail fetcherusing Gmail webmail.

Troubleshooting and Gmail quirks

  • If you're using the same Gmail account with multiple clients you need to enable recent mode in order to let each client access all of the messages in that account. You can do that by replacing username@gmail.com with recent:username@gmail.com as the username in Tools -> Account Settings -> Server Settings.
  • This thread has a screen shot of working settings for Gmails POP and SMTP servers.
  • Gmail treats POP and IMAP messages messages individually and not as a threaded conversation.

IMAP

The IMAP support is buggy/incomplete, though its improved a lot since it was first available.

  • \Answered and \Recent flags on messages are not supported.
  • Only the From, CC, BCC, To, and Subject headers can be searched. All searches are assumed to be words. Searching for messages based on the Subject fails if it contains a underscore, but incorrectly finds the message if the message body contains that string. Searching on Subject also fails if the search string contains a dot, open or close parenthesis while the message subjects contains the dot or parentheses. For example, a search of "2006.01.15" fails to find any message containing "2006.01.15" in the subject field (an exact search such as "2006.01.15 hello" also fails to find a message exactly titled "2006.01.15 hello").

The IMAP folders map to labels. If you look at the All Mail folder using Gmails webmail it will label any IMAP messages with the name of the folder. If you delete a message in Thunderbird it simply removes that folder's label from the message. Compacting the folder doesn't remove the message from the All Mail folder. You need to move it to the Trash (or Spam) folder to delete the message from all folders. Its not clear yet if this is also true for Message aging.

A copy of a message is stored for each label. That means if you assign two labels to a message and star it using Gmails webmail it has a copy in two folders named after the label, the All Mail folder, and the Starred folder. If you copy a message to multiple remote folders (using Thunderbird) it will be marked with the corresponding labels when viewed using Gmail webmail.

If you move a message into the Spam folder its treated the same as if you had reported it in Gmail webmail using 'Report Spam'. See How do actions sync in IMAP? on Gmails web site for more information on how it maps things.

Gmail recommends that you do not use [Gmail]/Trash as your Trash folder since Gmail only keeps a single copy of a message with multiple labels. If you delete a message that way you're also telling it to delete the same message from any other folder (label) that has that message. [1] [2]

Gmail imposes a unspecified limit on how many messages you can upload during a short amount of time. If you exceed it you get temporarily locked out of the account. Its not clear yet whether this is actually a bandwidth limit.

If large messages or attachments are truncated set mail.server.default.fetch_by_chunks = false to work around a size bug in Gmail.

Gmail has problems with non-ASCII characters in headers. This might occur if they're used in a recipients email address, folder names or tags . Set mail.imap.use_envelope_cmd = true to work around the bugs in Gmail header fields. [3] [4]

The Gmail list of known IMAP issues mentions that the "All Mail" folder can have well over 100,000 messages and that some email clients may crash if they try to process a folder with that many messages. Thunderbird doesn't have any known limit on the maximum number of messages in a folder, but most of the attention has been on the maximum size of a folder.

This forum thread discusses some more quirks.

SMTP (Sending messages)

  • If you send a message from your Gmail account to the same Gmail account in Thunderbird, that message will not be downloaded into Thunderbird/. The message will, however, appear in your Gmail Inbox if you log into your account using the Gmail web interface. This is not a bug in Thunderbird; it is a quirk in the way Gmail implements POP.
  • Gmail's SMTP server ignores whatever "From:" address you might specify using multiple identity support unless you add it in the Gmail web page at Setting -> Accounts -> "Add another email address".
  • If Thunderbird refuses to use the correct outgoing (SMTP) server, see the "Troubleshooting" section in this article.
  • The Gmail SMTP server also supports SSL connections using port 465. The instructions above state to use TLS because thats what Gmails instructions state and a few users seemed to have problems if they used SSL.
  • Gmail scans attachments for viruses and blocks any that it thinks contains executables. This includes .zip files. You can work around this by changing the filenames to use file extensions it doesn't recognize. However, since that violates their policies you could potentially lose your Gmail account. A better solution might be to use a free file hosting site such as RapidShare, MegaUpload or YouSendit and send a link to the file instead.
  • Gmail lets you use a different From: address but you have to register it using Gmail webmail at Setting -> Accounts -> "Add another email address" or it will ignore it and use your accounts email address.

See also

External links