Welcome to my site. Please CLICK HERE to give your opinions regarding this new look of "PCTipsbyAnu". Thanks for visiting.

Tuesday, September 7, 2010

Browse » Home » , , , , , » How to read e-mails of GMAIL via MUTT?

How to read e-mails of GMAIL via MUTT?


If you’re like me, you prefercommand line tools over GUI tools, and for email you prefer plaintext over HTMLformat. 

You can have the best of both worlds by using Gmail on the command linewith a tool like mutt, although it does take a bit of tweaking. 
If you preferto keep a copy of your mail locally, you can use POP3 (via fetchmail andprocmail) or something like OfflineIMAP to suck mail down and keep a localcopy, syncing the mail back and forth.

With mutt, however, because laterversions support IMAP and SMTP directly, you are able to work with your Gmailor Google Apps account using nothing more than mutt itself: no fetchmail, noprocmail, no OfflineIMAP. 

All of these tools are great, but Gmail has prettydecent filtering and the advantages of using the web UI when at a computer notyour own might make you prefer IMAP to sucking everything down via POP3 anyway.

Mutt is extremely straightforwardwhen used with Gmail.

First, you need to create a~/.muttrc with the following contents. These are really the bare-bones commandsyou need for mutt to work with Gmail (customize to suit passwords and emailaddress):

CODE
#A basic .muttrc for use with Gmail
#Change the following six lines to match your Gmail account details
setimap_user = "[user]@gmail.com"
setimap_pass = "[password]"
setsmtp_url = "smtp://[user]@gmail.com@smtp.gmail.com:587/"
setsmtp_pass = "[password]"
setfrom = "[user]@gmail.com"
setrealname = "[User Name]"
#Change the following line to a different editor you prefer.
seteditor = "vim"
#Basic config, you can leave this as is
setfolder = "imaps://imap.gmail.com:993"
setspoolfile = "+INBOX"
setimap_check_subscribed
sethostname = gmail.com
setmail_check = 120
settimeout = 300
setimap_keepalive = 300
setpostponed = "+[Gmail]/Drafts"
setrecord = "+[Gmail]/Sent Mail"
setheader_cache=~/.mutt/cache/headers
setmessage_cachedir=~/.mutt/cache/bodies
setcertificate_file=~/.mutt/certificates
setmove = no
setinclude
setsort = 'threads'
setauto_tag = yes
hdr_orderDate From To Cc
auto_viewtext/html
bindeditor complete-query
bindeditor ^T complete
bindeditor noop
#Gmail-style keyboard shortcuts
macroindex,pager y "unset trash\n" "Gmail archive message"
macroindex,pager d "settrash=\"imaps://imap.googlemail.com/[Gmail]/Bin\"\n" "Gmail delete message"
macroindex,pager gl ""
macroindex,pager gi "=INBOX" "Go toinbox"
macroindex,pager ga "=[Gmail]/All Mail""Go to all mail"
macroindex,pager gs "=[Gmail]/Starred""Go to starred messages"
macroindex,pager gd "=[Gmail]/Drafts""Go to drafts"
macroindex,pager gt "=[Gmail]/Sent Mail""Go to sent mail"

Next, you need to create thedirectories that mutt will need to store cache information, and also create themailcap file in order to view HTML messages and attachments:
$mkdir -p ~/.mutt/cache/{headers,bodies}
$echo "text/html; /usr/bin/elinks -force-html %s" >~/.mailcap

Change the path to the preferred CLIHTML browser of your choice: elinks is a great browser; lynx is good also

Youcan also add other entries to your mailcap if you prefer; such as launchingOpenOffice.org to view Word files (application/msword) or Evince for PDF files(application/pdf).

After this, you can start mutt andhave immediate access to your Gmail or Google Apps account. You will be askedto save the certificate information; if you select Always Allow, you won’t beprompted for it again.

This configuration is obviouslyquite sparse, and there are many tutorials online on how to spruce up mutt withcolors and other features. This is pretty much the bare minimum to get mutt towork with Gmail; you can send mail and read mail via IMAP, which allows you toget access to your mail account from anywhere that you can ssh into. Thekeybindings noted also mimic some of those keyboard shortcuts used in the webUI. For the paranoid, if you omit the passwords in the configuration file, muttwill ask you each time you start it up.
You can leave a response, or trackback from your own site.

About 'Anu': My name is 'Anu' also Known as 'ANU 007 TIGER' .I'm administrator of 'PC Tips by Anu' blog .This blog was opened for sharing contents about hacking n cracking.
Thanks YAHOO OR GMAIL

0 comments:

Post a Comment

 
Back to Top