Offlineimap : Différence entre versions

De Documentation Anelosimus
Aller à : navigation, rechercher
(Page créée avec « 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 IMA... »)
 
 
Ligne 39 : Ligne 39 :
 
Pour générer les données oauth2 :  
 
Pour générer les données oauth2 :  
 
<code>
 
<code>
[general]
+
This option stands in the [Repository RemoteExample] section.
accounts = Test
+
#
 +
# XOAuth2 authentication (for instance, to use with Gmail).
 +
#
 +
# This feature is currently EXPERIMENTAL (tested on Gmail only, but should work
 +
# with type = IMAP for compatible servers).
 +
#
 +
# Mandatory parameters are "oauth2_client_id", "oauth2_client_secret" and
 +
# "oauth2_refresh_token". See below to learn how to get those.
 +
#
 +
# Specify the OAuth2 client id and secret to use for the connection..
 +
# Here's how to register an OAuth2 client for Gmail, as of 10-2-2016:
 +
#    - Go to the Google developer console
 +
#        https://console.developers.google.com/project
 +
#    - Create a new project
 +
#    - In API & Auth, select Credentials
 +
#    - Setup the OAuth Consent Screen
 +
#    - Then add Credentials of type OAuth 2.0 Client ID
 +
#    - Choose application type Other; type in a name for your client
 +
#    - You now have a client ID and client secret
 +
#
 +
#oauth2_client_id = YOUR_CLIENT_ID
 +
#oauth2_client_secret = YOUR_CLIENT_SECRET
  
[Account Test]
+
# Specify the refresh token to use for the connection to the mail server.
localrepository = Croc
+
# Here's an example of a way to get a refresh token:
remoterepository = Gmail
+
#    - Clone this project: https://github.com/google/gmail-oauth2-tools
 
+
#    - Type the following command-line in a terminal and follow the instructions
[Repository Croc]
+
#        python python/oauth2.py --generate_oauth2_token \
type = IMAP
+
#            --client_id=YOUR_CLIENT_ID --client_secret=YOUR_CLIENT_SECRET
remotehost = localhost
+
#
remoteuser = commercial@crocnature.com
+
#oauth2_refresh_token = REFRESH_TOKEN
remotepass = 83PFUH2sAUjL
 
 
 
ssl = no
 
sslcacertfile = /etc/ssl/certs/ca-certificates.crt
 
readonly = true
 
 
 
[Repository Gmail]
 
type = Gmail
 
remoteuser = crocnature.commercial@gmail.com
 
remotepass = 83PFUH2sAUjL
 
folderfilter = lambda foldername: foldername not in ['[Gmail]/All Mail']
 
ssl = yes
 
sslcacertfile = /etc/ssl/certs/ca-certificates.crt
 
 
 
oauth2_client_id = 481427632881-g9hu6pr3oa34se50vhb0m57nb73v4tlb.apps.googleusercontent.com
 
oauth2_client_secret = 2lKdfjPhxhlbL0JXcz3BJVPR
 
oauth2_refresh_token = 1/JOr8D-YyxAEws1A6Ia5Nm2tqHJLlidd-8avVGgnFTn5IgOrJDtdun6zK6XiATCKT
 
 
</code>
 
</code>

Version actuelle datée du 3 novembre 2015 à 14:18

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