

(Discuss in Talk:Backup Gmail with getmail)īacking-up emails will suffice for most people, but if we want to migrate our emails to another account it gets a bit tricky. The -q parameter will run getmail in quiet mode and only report errors. We want to periodically run getmail to backup our Gmail account, so we will add a cron job: Now if we run getmail it will backup all Gmail emails to ~/bak/mail, outputting its status along the way. Setting delivered_to and received fields to false will prevent emails from being altered by getmail. # if set to true it will re-download ALL messages every time! Also, everything will be logged to ~/.getmail/log.

This tells getmail to be very verbose and tell us the status of each message (whether it was backed-up successfully, total number of messages, etc). This is normal, do not delete cur and tmp. All emails will be placed in 'new', and the cur and tmp folders will be left empty. The path field is the destination folder (which we created earlier) where the emails will be backed-up.
Backup gmail archive password#
The username and password fields need to be changed to your own. Also, you might need to replace box labels by whatever GMail calls that directory in the language of your Google account. The mailboxes variable must be set to in those cases. Even if all GMail accounts are migrated to the new name, the IMAP-Server still assumes Google Mail as the mail box directory. Note that Gmail was called Google Mail in some countries like Germany. The mailbox which we backup will be All Mail. For POP3 we can use the type SimplePOP3SSLRetriever, but we will also have to modify the server field. The retriever section tells getmail where to connect. This setting can be different from the language setting of the Google account. Tip: If the mailbox /Sent Mail does not exist, try setting your Gmail's language setting to English. Mailboxes = ("Inbox", "/Sent Mail") # optional - leave this line out to just grab the inbox ~/.getmail/getmailrc # More configuration options here: The cur, new and tmp folders are required by the Maildir format and by getmail.Įdit the configuration file and add the entries below. We also need to create the folder where the emails will be backed-up:įor this example ~/bak/mail was chosen, but it could just as well be ~/mail. Unfortunately this directory and file do not exist by default, so we need to create them. Getmail reads its configuration from ~/.getmail/getmailrc by default. We can use getmail to fully backup email messages from a Gmail account.Įmails will be backed-up in Maildir format, meaning that each email will be a separate text file, readable with any email client, or even with a text editor. (Discuss in Talk:Backup Gmail with getmail) Notes: Only #Troubleshooting is specific to Gmail.
