Created
January 8, 2014 09:17
-
-
Save eightbitraptor/8313954 to your computer and use it in GitHub Desktop.
offlineimaprc
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
[general] | |
ui = ttyui | |
accounts = Eightbitraptor | |
pythonfile=~/.mutt/offlineimap.py | |
fsync = False | |
cacertfile = ~/.mutt/certificates | |
[Account Eightbitraptor] | |
localrepository = Eightbitraptor-Local | |
remoterepository = Eightbitraptor-Remote | |
status_backend = sqlite | |
[Repository Eightbitraptor-Local] | |
type = Maildir | |
localfolders = ~/.mail/matt-eightbitraptor.com | |
nametrans = lambda folder: {'drafts': '[Gmail]/Drafts', | |
'sent': '[Gmail]/Sent Mail', | |
'flagged': '[Gmail]/Starred', | |
'trash': '[Gmail]/Trash', | |
'archive': '[Gmail]/All Mail', | |
}.get(folder, folder) | |
[Repository Eightbitraptor-Remote] | |
cert_fingerprint=89091347184d41768bfc0da9fad94bfe882dd358 | |
maxconnections = 1 | |
type = Gmail | |
remoteuser = [email protected] | |
remotepasseval = get_keychain_pass(account="[email protected]", server="imap.gmail.com") | |
realdelete = no | |
nametrans = lambda folder: {'[Gmail]/Drafts': 'drafts', | |
'[Gmail]/Sent Mail': 'sent', | |
'[Gmail]/Starred': 'flagged', | |
'[Gmail]/Bin': 'trash', | |
'[Gmail]/All Mail': 'archive', | |
}.get(folder, folder) | |
folderfilter = lambda folder: folder not in ['[Gmail]/Trash', | |
'[Airmail]', | |
'[Airmail]/Done', | |
'[Airmail]/Memo', | |
'[Airmail]/To Do', | |
'[Gmail]/Important', | |
'[Gmail]/Spam', | |
] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/python | |
import re, subprocess | |
def get_keychain_pass(account=None, server=None): | |
params = { | |
'security': '/usr/bin/security', | |
'command': 'find-internet-password', | |
'account': account, | |
'server': server, | |
'keychain': '/Users/matthewvalentine-house/Library/Keychains/login.keychain', | |
} | |
command = "sudo -u matthewvalentine-house %(security)s -v %(command)s -g -a %(account)s -s %(server)s %(keychain)s" % params | |
output = subprocess.check_output(command, shell=True, stderr=subprocess.STDOUT) | |
outtext = [l for l in output.splitlines() | |
if l.startswith('password: ')][0] | |
return re.match(r'password: "(.*)"', outtext).group(1) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment