How to use isync and the dovecot mail server to read your Gmail in Emacs efficiently

I have been using using Sacha Chua’s how to on using offlineimap and dovecot several times. But when I bought my latest notebook I wasn’t able to get offlineimap up and running. I’m currently using mbsync. Which is much faster and easier to configure.

I’m using ArchLinux but you should be able to adapt this guide on any other Linux distribution.

Install and configure isync

yaourt -S isync

The isync configuration file is named .mbsyncrc

edit ~/.mbsyncrc
IMAPAccount gmail
# Address to connect to
#Pass ***************
# To store the password in an encrypted file use PassCmd instead of Pass
#PassCmd "gpg2 -q --for-your-eyes-only --no-tty -d ~/.mailpass.gpg"
# Use SSL
UseIMAPS yes
# The following line should work. If get certificate errors, uncomment the two following lines and read the "Troubleshooting" section.
CertificateFile /etc/ssl/certs/ca-certificates.crt
#CertificateFile ~/.cert/
#CertificateFile ~/.cert/Equifax_Secure_CA.pem

IMAPStore gmail-remote
Account gmail

MaildirStore gmail-local
# The trailing "/" is important
Path ~/mail/
Inbox ~/mail/Inbox

Channel gmail
Master :gmail-remote:
Slave :gmail-local:
# Exclude everything under the internal [Gmail] folder, except the interesting folders
Patterns * ![Gmail]* "[Gmail]/Sent Mail" "[Gmail]/Starred" "[Gmail]/All Mail"
# Or include everything
#Patterns *
# Automatically create missing mailboxes, both locally and on the server
Create Both
# Save the synchronization state files in the relevant directory
SyncState *

Edit the password and you are done.

Create the folders for your mail

mkdir -p ~/mail/Inbox

Install and configure dovecot

Install dovecot

pacman -S dovecot

Edit the main configuration file for dovecot

edit /etc/dovecot/dovecot.conf and set these lines:

protocols = imap

listen = *, ::

edit /etc/dovecot/conf.d/10-auth.conf and set these lines:

auth_mechanisms = plain

passdb {
args = /etc/dovecot/passwd
driver = passwd-file

!include auth-system.conf.ext

edit /etc/dovecot/conf.d/10-mail.conf and set these lines:

mail_location = maildir:/home/me/mail/Inbox/

namespace inbox {

inbox = yes


start dovecot

systemctl start dovecot
systemctl enable dovecot

initial sync

start the initial sync


mbsync -a

and look at output and wait. Isync is faster than offlineimap but the initial sync will still take some time.

create a cronjob for syncing

fcrontab -e

@ 10 /usr/bin/mbsync -a

configure gnus

edit ~/.gnus

(setq gnus-select-method
'(nnimap "Mail"
(nnimap-address "localhost")
(nnimap-stream network)
(nnimap-authenticator login)
(nnir-search-engine imap)))

(setq user-mail-address “”)
(setq gnus-ignored-from-addresses “”)

; set gmail smtp
(setq message-send-mail-function ‘smtpmail-send-it
smtpmail-starttls-credentials ‘((“” 587 nil nil))
smtpmail-auth-credentials ‘((“” 587 “” nil))
smtpmail-default-smtp-server “”
smtpmail-smtp-server “”
smtpmail-smtp-service 587)
;      smtpmail-local-domain “”)

and you are done.

access your emails in gnus

This is from Sacha Chuas blog:

Start Emacs. Start Gnus with M-x gnus. If you don’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’re subscribed to the group.

Have fun!


bookmarking with uzbl and org-capture

I found this in a russian e-mail list archive (I haven’t found it again)

I use this little trick to capture bookmarks from my uzbl-browser.

Just add:

@cbind <Ctrl>e = sh ’emacsclient “org-protocol://capture://\\@/\\@”‘

to your


Every time I find something useful on the web I just press <Ctrl>e in my uzbl-browser and the current URL is send to my emacs. In emacs I can now turn the URL in a task, note, whatever and refile it to one of my projects. This way the information (the link) i stored where I need it.

My current org-capture setup is based on the excellent guide by Bernt Hansen.

using org2blog to blog with

howto blog from your emacs org-mode using org2blog

setting up emacs for blogging with wordpress is pretty easy. There are some packages out there which could do that job. I chose org2blog.

installing org2blog

you can install org2blog from github

just do

cd ~/.emacs.d

git clone

Add the org2blog directory to your load path and then add

(setq load-path (cons “~/.emacs.d/org2blog/” load-path)) (require ‘org2blog-autoloads)

installing xml-rpc

org2blog requires xml-rpc. xml-rpc can be installed through the emacs package manager (until than I didn’t know anything about that).

to install xml-rpc just

M-x package-install xml-rpc

i had to add manually the load-path to xml-rpc.el in my .emacs

(setq load-path (cons “~/.emacs.d/elpa/xml-rpc-1.6.7/” load-path))

configuring org2blog

just add a few lines to your .emacs as described on the github-page

(setq org2blog/wp-blog-alist ‘((“wordpress” :url “” :username “username” :default-title “Hello World” :default-categories (“org2blog” “emacs”) :tags-as-categories nil)))

reload emacs to load the changes

now run

M-x eval-buffer

while in the .emacs buffer to load the changes

test your setup

now open a new org file.

to test org2blog you can now

M-x org2blog/wp-post-buffer

your post should now appear in your wordpress blog as a draft