Skip to main content

Configuration of Gmail on Gnus/Emacs (Ubuntu Gutsy)

I tried configuring Gnus/Emacs to send/receive mails through Gmail using IMAP/SMTP protocol on my Ubuntu-Gutsy Linux Box.

Emacs Version: 22.1.1
Gnus Version: 5.11

I performed the following steps:

  • I had to install sendmail and starttls programs using apt-get first and start sendmail service.

  • Enable IMAP support for your Gmail account online as described here :
    http://mail.google.com/support/bin/answer.py?answer=77695


  • Create a file named .gnus.el in your home directory and copy the configuration as given below:


    ;; Configuration of ~/.gnus.el

    ;; Customize the next three lines with your ISP information.
    (load "starttls")
    (load-library "smtpmail")

    (setq user-mail-address "username@gmail.com")
    (setq user-full-name "User Name")

    ;; Configure incoming mail (IMAP)
    (setq gnus-select-method '(nnimap "gmail"
    (nnimap-address "imap.gmail.com")
    (nnimap-server-port 993)
    (nnimap-authinfo-file "~/.imap-authinfo")
    (nnimap-stream ssl)))

    ;; Configure outbound mail (SMTP)
    (setq smtpmail-starttls-credentials '(("smtp.gmail.com" 587 nil nil))
    smtpmail-smtp-server "smtp.gmail.com"
    smtpmail-default-smtp-server "smtp.gmail.com"
    send-mail-function 'smtpmail-send-it
    message-send-mail-function 'smtpmail-send-it
    smtpmail-smtp-service 587
    smtpmail-auth-credentials '(("smtp.gmail.com" 587 "username@gmail.com" nil))
    smtpmail-debug-info t
    smtpmail-debug-verb t
    )
    (setq smtpmail-local-domain nil)
    (setq gnus-permanently-visible-groups "gmail")
    (executable-find starttls-program)

  • Create another file named .imap-authinfo in your home directory with the following line:

    machine imap.gmail.com login username@gmail.com password my_password port 993

  • Now, start Emacs, and type M-x gnus to launch Gnus. Gnus should automatically check for email on Gmail.com. After a while, when gnus process completes it displays a list of subscribed mailboxes. By default, you are subscribed to nndoc+gnus-help:gnus-help mailbox only.

  • To add your Gmail INBOX and other Gmail Labels you need to add them as mailboxes. Type 'U' in the Gnus Group Buffer and type the name of the Gmail Label or type INBOX to subscribe that Label to Gnus. You can also use auto-completion feature here to list all labels.

  • Now, you should see the subscribed Mailboxes in the Groups buffer. You can press 'Enter' on any mailbox to read mails under that label.

  • To send an email, type 'm'. You should get a buffer to send email. Remember here that it will prompt you to enter your password to send emails every time. If you wish to skip this step, change the value of smtpmail-auth-credentials variable in .gnus.el file you just created :

    smtpmail-auth-credentials '(("smtp.gmail.com" 587 "username@gmail.com" "password"))

  • You can change the permissions on the file .gnus.el and .imap-authinfo to restrict the access to your username only.

  • chmod 700 ~/.gnus.el ~/.imap-authinfo
All the above steps must configure Emacs to send and receive email using Gmail successfully. Hope this helps!

Popular posts from this blog

iPod Nano 5G synchronization issues in Ubuntu

I was able to manage my iPod Nano using Ubuntu until now. When I recently upgraded to Ubuntu 11.04 Natty which was a clean install, a weird problem started. I could not synchronize my iPod using any application like Banshee, Rhythmbox, gtkpod, Amarok etc. On closer look, I realized that when I transferred any file, it was copied to the iPod but the database on iPod was not updated. None of the applications seemed to work and it was same error in each case. Since the iPod database was not updated, iPod could not see the file and was unable to play it. It was an iPod Nano generation 5, which comes with a video camera on the back side. To debug the issue, I executed Banshee in debug mode (banshee -debug on the terminal), and I noticed the following error when trying to transfer any file on iPod. ‘Failed to save iPod database – GLib.GException: Failed to generate sqlite database (in `libgpod-sharp)’ I searched for solutions on Internet but was confused at various solutions suggest...

Sydney Trip

I went to Sydney on a business trip for 2-3 weeks. Since, it was a business trip I was going to travel alone and miss my family. Therefore, I appreciated the short duration of the trip but it did not feel like a short one. Most of it was work only and some time for me during the two weekends. I had decided to make the most of available time instead of idling and feel more homesick. Also, I was going to stay in the CBD area so it was a big advantageous factor since not much effort was to be spent for sightseeing. The journey began with the longest flight I’ve ever been on (17 hours) with a stopover at Bangkok for 2 hours. I had a terrible time in the flight from Delhi to Bangkok; I was struggling a lot in the airplane seats and couldn’t sleep at all. However, the flight from Bangkok to Sydney was much better. On my flight from Bangkok to Sydney, an Australian lady was seated at the window seat on my right hand side. She asked me if I wanted to swap my seat with hers as I had starte...

Busy or Lazy?

Either of the two. But that’s been the case after my wedding. I’ve not done a blog post, neither I did anything on Facebook, Twitter, Google+ for that matter. Whatever! Better late than never. So, in order of priority, I wanted to write down a few important events that happened since my last post - We were blessed with a baby daughter – Naisha. Literal meaning of Naisha is ‘Special’ and she justifies this meaning completely. She’s beautiful, cranky and a fighter. She’s awesome! Naisha is one creature in the house. She just celebrated her first birthday dressed up as a Barbie, which was cute. All the day she’s running around the house and interpreting various things and objects in her unique style. I cannot understand much of it, but most of it appears very logical somehow. I switched from X to Y organization. It was a long pending decision for me and thankfully it worked out this time. It took its own time and I was recruited after long six months of interviewing process. A...