Skip to content

Instantly share code, notes, and snippets.

@dabrahams
Created July 1, 2012 23:07
Show Gist options
  • Save dabrahams/3029970 to your computer and use it in GitHub Desktop.
Save dabrahams/3029970 to your computer and use it in GitHub Desktop.
Offlineimap configuration
[general]
accounts = BoostPro,Spam,ArchiveSync,PersonalGMail
maxsyncaccounts = 5
fsync = false
pythonfile = ~/.offlineimap/offlineimap_config.py
[Repository BoostProLocal]
type = IMAP
remotehost = localhost
holdconnectionopen = yes
preauthtunnel = /usr/local/libexec/dovecot/imap
######################
# Accounts #
######################
###### BoostPro ########
#
# syncs and idles INBOX
[Account BoostPro]
status_backend = sqlite
localrepository = BoostProLocal
remoterepository = BoostProRemote
autorefresh = 17
postsynchook = /Users/dave/bin/imap-postsync localhost dave --soft-errors
quick = 3
[Repository BoostProRemote]
type = Gmail
remoteuser = dave@boostpro.com
remotepasseval = osxkeychain('imap.gmail.com', account='dave@boostpro.com')
cert_fingerprint = f3043dd689a2e7dddfbef82703a6c65ea9b634c1
realdelete = no
folderfilter = lambda foldername: foldername in ['INBOX', '[Gmail]/Important' ]
keepalive = 60
holdconnectionopen = yes
idlefolders = ['INBOX']
######################
[Account ArchiveSync]
status_backend = sqlite
localrepository = BoostProLocal
remoterepository = ArchiveRemote
autorefresh = 13
quick = 3
[Repository ArchiveRemote]
type = Gmail
cert_fingerprint = f3043dd689a2e7dddfbef82703a6c65ea9b634c1
remoteuser = dave@boostpro.com
remotepasseval = osxkeychain('imap.gmail.com', account='dave@boostpro.com')
folderfilter = lambda foldername: foldername in ['[Gmail]/All Mail']
keepalive = 60
holdconnectionopen = yes
idlefolders = ['[Gmail]/All Mail']
readonly = true
######################
[Account PersonalGMail]
status_backend = sqlite
localrepository = BoostProLocal
remoterepository = PersonalGMailRemote
autorefresh = 37
quick = 3
[Repository PersonalGMailRemote]
type = Gmail
cert_fingerprint = f3043dd689a2e7dddfbef82703a6c65ea9b634c1
remoteuser = dave.abrahams@gmail.com
remotepasseval = osxkeychain('imap.gmail.com', account='dave.abrahams')
folderfilter = lambda foldername: foldername in ['INBOX']
nametrans = lambda folder: 'PersonalGMail' if folder == 'INBOX' else folder
holdconnectionopen = yes
realdelete = no
idlefolders = ['INBOX']
######################
[Account Spam]
status_backend = sqlite
localrepository = BoostProLocalReadOnly
remoterepository = BoostProRemoteSpam
autorefresh = 43
quick = 8
holdconnectionopen = no
[Repository BoostProLocalReadOnly]
type = IMAP
remotehost = localhost
holdconnectionopen = yes
preauthtunnel = /usr/local/libexec/dovecot/imap
readonly = true
[Repository BoostProRemoteSpam]
type = Gmail
cert_fingerprint = f3043dd689a2e7dddfbef82703a6c65ea9b634c1
remoteuser = dave@boostpro.com
remotepasseval = osxkeychain('imap.gmail.com', account='dave@boostpro.com')
folderfilter = lambda foldername: foldername in ['[Gmail]/Spam']
import subprocess
def gmailfolder2maildir(gmail_folder_name):
if gmail_folder_name == '': return None
return '' if gmail_folder_name == 'INBOX' else '.' + gmail_folder_name
def osxkeychain(service, account = None, type="internet"):
acct = account and [ '-a', account ] or []
args = ['/usr/bin/security', 'find-'+type+'-password', '-gs', service] + acct
p = subprocess.Popen(args, stdout=subprocess.PIPE, stderr=subprocess.PIPE, close_fds=True)
lines = p.stderr.readlines()
return lines[0].split('"')[1]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment