Posts Tagged ‘ubuntu’

As Gmail has IMAP access, it is fairly trivial to get it working with mutt. First, if you’re on Ubuntu/Debian, run sudo apt-get install openssl mutt to get mutt if you don’t already have it. Then, just put the following lines into your ~/.muttrc:

set imap_user = "username@gmail.com"
set imap_pass = "password"
set smtp_url = "smtp://username@smtp.gmail.com:587/"
set smtp_pass = "password"
set from = "username@gmail.com"
set realname = "Your Real Name"
set folder = "imaps://imap.gmail.com:993"
set spoolfile = "+INBOX"
set postponed="+[Gmail]/Drafts"
set header_cache=~/.mutt/cache/headers
set message_cachedir=~/.mutt/cache/bodies
set certificate_file=~/.mutt/certificates
set move = no

Make sure your ~/.muttrc isn’t world-readable; it contains your password. (Alternatively, you can leave them out and mutt will prompt you for the password each time.) Also, if you copy-paste from the above, make sure that you have only “normal” quotes, not “smart quotes” which WordPress might have inserted here into this post.

Things work perfectly as you would expect them.
One thing to note is that the full headers will still contain the hostname of the computer you send messages from. I have not figured a way of hiding this, and perhaps it shouldn’t be possible.

The End

If for some reason you want to use POP, read on. And tell me why you would want to use POP. The rest of the post is an old version, which i had written before Gmail supported IMAP.

Old StuffThere is a guide here, which is the first Google result on searching for the keywords Gmail, mutt and Ubuntu in any order, but I would advise against it: it does too much unnecessary stuff using too many unnecessary programs (okay if you don’t care), and involves putting your username and password in a world-readable file (not okay).

There is a guide here, but that site seems down, and so I guess it’s likely to be down again (a DynDNS domain; could be someone’s house), so putting a (fuller) guide here:

Next, create a shell script with the contents
#!/bin/sh
/usr/sbin/ssmtp -au "gmail-address" -ap "password" $@ and put it somewhere in your path (~/bin/gmailout, say) and make it executable (chmod u+x ~/bin/gmailout, I mean) and make sure only you can read it! (chmod og-r ~/bin/gmailout).

You can start mutt, and hit “G” (uppercase G) whenever you want to fetch mail. Can also put exec fetch-mail in ~/.muttrc to have it happen whenever you start mutt, but I find that irritating.

Problems with POP: Not that everything is perfect. I can’t have other mail-transport-agents like sendmail or postfix installed alongside ssmtp. I can’t figure out how to get my crontab reports sent to root, but they do go into ~/dead.letter :D
Also, with mutt I had the habit of adding a my_hdr bcc: my-email-address so that the mail I send is threaded along with the mail I receive (yaay, like Gmail), but somehow there seems to be simply no way of getting Gmail to give me, through POP, those messages I send using an external client. It’s a quirk [bug!] in the way Gmail implements POP. This I’ve fixed by setting mutt’s fcc to /var/mail/my-username, my mail folder. (Of course, if I were in the habit of moving mail to my mbox, I could fcc to mbox too.)
Apart from that, it works fine!

There is a package called debian-goodies (that’s what it’s called on Ubuntu as well :-)) which has this utility called dpigs — for telling you which packages are “pigging out” on your system. (So install it with sudo apt-get install debian-goodies, and then run dpigs). This and other utilities, from the description:

debget - Fetch a .deb for a package in APT's database
dpigs - Show which installed packages occupy the most space
debman - Easily view man pages from a binary .deb without extracting
checkrestart - Help to find and restart processes which are using old
versions of upgraded files (such as libraries)
popbugs - Display a customized release-critical bug list based on
packages you use (using popularity-contest data)