gmail integration in emacs

i think it is fun to have emacs act as your mail client. its like when u are busy writing code, and you got to send in some snippets or a quick mail on the issue, you just don’t leave the editor!. so here is how you integrate emacs to access your gmail compose. Note, your mails sent from emacs are also stores in the “sent” label on your gmail!

pre-requisites

  1. emacs 23.2
    Use the latest version of emacs, I used emacs23.2 while i made the customization.

    download emacs from http://ftp.gnu.org/gnu/emacs/

  2. gnutls
    gnutls is the gnu transport layer security library which ensures secure client/server communication over the transport layer.

    http://www.gnu.org/software/gnutls/gnutls.html for more info on gnutls

  3. Libgcrypt
    To build gnutls, this package may be required it is provided in the gnutls download link along with gnu tls. One might have to download it separately.

The .authifo File

  1. The authinfo file stores the login information for the mail account. Create the .authinfo file
  2. Insert the following line into the .authinfo file which u can create and place in the ~/. directory

    machine smtp.gmail.com login @gmail.com password

  3. Modify the permissions of the .authinfo file as follows

    chmod go-rwx .authinfo
    chmod u+rw .authinfo

Emacs Init Config (.emacs)

Add this section to your .emacs

;; email setting for my emac
(setq send-mail-function ‘smtpmail-send-it
message-send-mail-function ‘smtpmail-send-it
smtpmail-starttls-credentials
‘((“smtp.gmail.com” 587 nil nil))
smtpmail-auth-credentials
(expand-file-name “~/.authinfo”)
smtpmail-default-smtp-server “smtp.gmail.com”
smtpmail-smtp-server “smtp.gmail.com”
smtpmail-smtp-service 587
smtpmail-debug-info t)

Sending mail
The keybinding for emacs to send mail is

  1. C-x m to compose mail
  2. C-c C-c to send mail when you are done composing the mails

Thanks

Shyam

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: