Offlineimap

De Documentation Anelosimus
Aller à : navigation, rechercher

Offline Imap sert initialement à synchroniser des boîtes mail entre elles où vers un dossier local. On s'en sert ici uniquement dans le sens sauvegarde d'une boîte IMAP standard vers gmail.

Installation de OfflineImap : http://offlineimap.org/doc/installation.html#single-user

~/ [general] accounts = Test

[Account Test] localrepository = Croc remoterepository = Gmail

[Repository Croc] type = IMAP remotehost = imap.server.org remoteuser = mail@server.org remotepass = password

ssl = yes or no sslcacertfile = /etc/ssl/certs/ca-certificates.crt readonly = true

[Repository Gmail] type = Gmail remoteuser = mail@gmail.com remotepass = password folderfilter = lambda foldername: foldername not in ['[Gmail]/All Mail'] ssl = yes sslcacertfile = /etc/ssl/certs/ca-certificates.crt

oauth2_client_id = Client ID oauth2_client_secret = secret ID oauth2_refresh_token = refresh token

Pour générer les données oauth2 : This option stands in the [Repository RemoteExample] section.

  1. XOAuth2 authentication (for instance, to use with Gmail).
  2. This feature is currently EXPERIMENTAL (tested on Gmail only, but should work
  3. with type = IMAP for compatible servers).
  4. Mandatory parameters are "oauth2_client_id", "oauth2_client_secret" and
  5. "oauth2_refresh_token". See below to learn how to get those.
  6. Specify the OAuth2 client id and secret to use for the connection..
  7. Here's how to register an OAuth2 client for Gmail, as of 10-2-2016:
  8. - Go to the Google developer console
  9. https://console.developers.google.com/project
  10. - Create a new project
  11. - In API & Auth, select Credentials
  12. - Setup the OAuth Consent Screen
  13. - Then add Credentials of type OAuth 2.0 Client ID
  14. - Choose application type Other; type in a name for your client
  15. - You now have a client ID and client secret
  16. oauth2_client_id = YOUR_CLIENT_ID
  17. oauth2_client_secret = YOUR_CLIENT_SECRET
  1. Specify the refresh token to use for the connection to the mail server.
  2. Here's an example of a way to get a refresh token:
  3. - Clone this project: https://github.com/google/gmail-oauth2-tools
  4. - Type the following command-line in a terminal and follow the instructions
  5. python python/oauth2.py --generate_oauth2_token \
  6. --client_id=YOUR_CLIENT_ID --client_secret=YOUR_CLIENT_SECRET
  7. oauth2_refresh_token = REFRESH_TOKEN