<?xml version="1.0" encoding="UTF-8"?><?xml-stylesheet href="/assets/atom.xsl" type="text/xsl"?><feed
	xmlns="http://www.w3.org/2005/Atom"
	xmlns:thr="http://purl.org/syndication/thread/1.0"
	xml:lang="en-US"
	><title>Sacha Chua - tag - offlineimap</title>
	<subtitle>Emacs, sketches, and life</subtitle>
	<link rel="self" type="application/atom+xml" href="https://sachachua.com/blog/tag/offlineimap/feed/atom/index.xml" />
  <link rel="alternate" type="text/html" href="https://sachachua.com/blog/tag/offlineimap" />
  <id>https://sachachua.com/blog/tag/offlineimap/feed/atom/index.xml</id>
  <generator uri="https://11ty.dev">11ty</generator>
	<updated>2008-05-09T02:07:09Z</updated>
<entry>
		<title type="html">Geek: How to use offlineimap and the dovecot mail server to read your Gmail in Emacs efficiently</title>
		<link rel="alternate" type="text/html" href="https://sachachua.com/blog/2008/05/geek-how-to-use-offlineimap-and-the-dovecot-mail-server-to-read-your-gmail-in-emacs-efficiently/"/>
		<author><name><![CDATA[Sacha Chua]]></name></author>
		<updated>2015-12-25T04:53:24Z</updated>
    <published>2008-05-09T02:07:09Z</published>
    <category term="emacs" />
<category term="geek" />
		<id>https://sachachua.com/blog/?p=4858</id>
		<content type="html"><![CDATA[<div class="update">2015-12-24: Updated with config changes now that I&#8217;m back to using Gnus+dovecot+offlineimap+Gmail</div>
<div class="update">2014-04-09: This post is from 2008. =) I think I used dovecot+offlineimap because Gnus and maildir weren&#8217;t getting along properly and directly connecting with IMAP to Gmail&#8217;s server was slow, but things have probably changed a fair bit since then. I eventually moved to using the Gmail web interface for most things, but I still miss my Gnus setup!</div>
<blockquote>
<ol>
</ol>
<ol>
<li>Make sure you&#8217;ve set up Postfix or some other mail server that can send mail.</li>
<li>Install dovecot (IMAP server) and offlineimap (IMAP synchronization). You can probably find binaries for your distribution.</li>
<li>Edit /etc/dovecot/conf.d/10-mail.conf and set the following:
<pre>mail_location = maildir:~/Maildir:LAYOUT=fs</pre>
</li>
<li>Use the instructions from <a href="http://unix.stackexchange.com/questions/44214/encrypt-offlineimap-password">http://unix.stackexchange.com/questions/44214/encrypt-offlineimap-password</a> to set up GPG-encrypted passwords. (optional)</li>
<li>Put the following in ~/.offlineimaprc, changing the details as needed.
<pre>[general]
accounts = SachaGmail
pythonfile = ~/bin/offlineimap-password.py

[Account SachaGmail]
localrepository = Local
remoterepository = Gmail
status_backend = sqlite

[Repository Local]
type = Maildir
localfolders = ~/Maildir

[Repository Gmail]
type = Gmail
maxconnections = 2
remoteuser = sacha@sachachua.com
realdelete = no
folderfilter = lambda foldername: foldername in ['INBOX', '[Gmail]/All Mail', '[Gmail]/Sent Mail', '[Gmail].Starred', '[Gmail].Drafts', '[Gmail].Important']
nametrans = lambda folder: re.sub('^INBOX$', '[Gmail].Inbox', folder)
sslcacertfile = /etc/ssl/certs/ca-certificates.crt
remotepasseval = mailpasswd("gmail")
</pre>
<p>If you feel comfortable specifying your password in your ~/.offlineimaprc, you can do so by changing remotepasseval to remotepass. If so, you don&#8217;t need the pythonfile line.</p></li>
<li><kbd>chmod go-rwx ~/.offlineimaprc</kbd> for a little bit of safety.</li>
<li>Type <b>offlineimap</b> to start synchronizing.</li>
<li>While that&#8217;s synchronizing, use something like this as your ~/.gnus:
<pre>(setq gnus-select-method
      '(nnimap "Mail"
	       (nnimap-address "localhost")
	       (nnimap-stream network)
	       (nnimap-authenticator login)))

(setq user-mail-address "youremail@example.com")
(setq gnus-ignored-from-addresses "youruser")
</pre>
</li>
<li>Start Emacs. Start Gnus with M-x gnus. If you don&#8217;t see the INBOX group, press ^ (gnus-group-enter-server-mode), open nnimap:Mail, move your cursor to the INBOX, and either press RET to go into the group or press u (gnus-browse-unsubscribe-current-group) to toggle the subscription status until you&#8217;re subscribed to the group. Then it should show up on the group screen (M-x gnus).</li>
</ol>
<p>Hope that helps. Have fun!</p></blockquote>
<p>You can <a href="https://sachachua.com/blog/2008/05/geek-how-to-use-offlineimap-and-the-dovecot-mail-server-to-read-your-gmail-in-emacs-efficiently/#comment">view 6 comments</a> or <a href="mailto:sacha@sachachua.com?subject=Comment%20on%20https%3A%2F%2Fsachachua.com%2Fblog%2F2008%2F05%2Fgeek-how-to-use-offlineimap-and-the-dovecot-mail-server-to-read-your-gmail-in-emacs-efficiently%2F&body=Name%20you%20want%20to%20be%20credited%20by%20(if%20any)%3A%20%0AMessage%3A%20%0ACan%20I%20share%20your%20comment%20so%20other%20people%20can%20learn%20from%20it%3F%20Yes%2FNo%0A">e-mail me at sacha@sachachua.com</a>.</p>]]></content>
		</entry>
</feed>