Advertisement
Guest User

Untitled

a guest
Sep 25th, 2017
452
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.11 KB | None | 0 0
  1. [general]
  2. accounts = Gmail
  3. maxsyncaccounts = 2
  4. pythonfile = ~/.offlineimap.py
  5.  
  6.  
  7. [Account Gmail]
  8. localrepository = LocalGmail
  9. remoterepository = RepositoryGmail
  10. autorefresh = 5
  11. quick = 10
  12. postsynchook = mu index --maildir ~/Maildir
  13. status_backend = sqlite
  14.  
  15. [Reposiroty LocalGmail]
  16. type = Maildir
  17. localfolders = ~/Maildir/Gmail
  18.  
  19. [Reposiroty RepositoryGmail]
  20. type = Gmail
  21. maxconnections = 2
  22. remoteuser = myemail@gmail.com
  23. remotepass = mailpasswd('gmail')
  24. folderfilter = lambda foldername: foldername not in ['[Gmail]/All Mail', '[Gmail]/Important']
  25.  
  26. def mailpasswd(acct):
  27. acct = os.path.basename(acct)
  28. path = "/PATH/.passwd/%s.gpg" % acct
  29. args = ["gpg", "--use-agent", "--quiet", "--batch", "-d", path]
  30. try:
  31. return subprocess.check_output(args).strip()
  32. except subprocess.CalledProcessError:
  33. return ""
  34.  
  35.  
  36. def prime_gpg_agent():
  37. ret = False
  38. i = 1
  39. while not ret:
  40. ret = (mailpasswd("prime") == "prime")
  41. if i > 2:
  42. from offlineimap.ui import getglobalui
  43. sys.stderr.write("Error reading in passwords. Terminating.n")
  44. getglobalui().terminate()
  45. i += 1
  46. return ret
  47.  
  48. prime_gpg_agent()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement