Mutt has issues with the latest ubuntu. Looking for answers, may have to use backport files.


Linux command line email can be a very good thing. For example. if for some reason. you should lose your gui interface then you can still interact with the world. Personally I like it because not using the gui allows the machine to work faster and I can use an old laptop or desktop with less than up to date resources. Besides you can automate certain procedures repeatably, that you can not always do in a graphical environment. Hopefully once again you will have less reason to send a computer to the landfill.

NOTE:if you want to use mutt with at least gmail you will have to set gmail to use a less secure login. Not recommended,

see:Access for less secure apps DisabledSettings

Step 1: Get Your Gmail Account.

We need what is called a relay agent. Gmail can do that for us. It will be our mailman so to speak. If you have not already done so you need to install a command line browser. Yes, you can access the web from the command line.

$ sudo apt-get install links2

Using links2, you will need to go to www.gmail.com and set up an account if you do not already have one.

$ links2 http://www.gmail.com

Go to create account and create one.

Do not forget to write down your username, password, and real name. You will need it in the next step.

Note for sake of reference, included is a gui picture of the gmail site.

Step 2: Mutt Set Up.

Mutt has been around a long time. Great for using on low end machines. You can even do automation very easily with it. www.commandlinefu.com has some excellent examples. Let's install the software.

$ sudo apt-get mutt openssl

Or for RH based systems you could use:

$ sudo yum install mutt openssl

Let's make some directories to store information..

$ mkdir .mutt
$ mkdir .mutt/cache

$ mkdir .mutt/certificates

# mkdir .mutt/cache/bodies

$ mkdir .mutt/cache/headers

Now you need to create a file with your special information and settings. I have collected a lot of the settings that other people use to save you a lot of time. So you will need to create a mutt (mail) settings file. We want to use a dot in front of the file name to aid in keeping it hidden.

$ $EDITOR .muttrc


$ nano .muttrc

You will want to paste the following into the .muttrc file: (not the dashes though!!) (updated)

# A basic .muttrc for use with Gmail

# Change the following six lines to match your Gmail account details
set imap_user = "YOUR.EMAIL@gmail.com"
set imap_pass = "PASSWORD"
set smtp_url = "smtp://YOUR.EMAIL@smtp.gmail.com:587/"
set smtp_pass = "PASSWORD"
set from = "YOUR.EMAIL@gmail.com"
set realname = "YOUR NAME"

# Change the following line to a different editor you prefer.
set editor = "nano"

# Basic config, you can leave this as is
set folder = "imaps://imap.gmail.com:993"
set spoolfile = "+INBOX"
set imap_check_subscribed
set hostname = gmail.com
set mail_check = 120
set timeout = 300
set imap_keepalive = 300
set postponed = "+[GMail]/Drafts"
set record = "+[GMail]/Sent Mail"
set header_cache=~/.mutt/cache/headers
set message_cachedir=~/.mutt/cache/bodies
set certificate_file=~/.mutt/certificates
set move = no
set include
set sort = 'threads'
set sort_aux = 'reverse-last-date-received'
set auto_tag = yes
ignore "Authentication-Results:"
ignore "DomainKey-Signature:"
ignore "DKIM-Signature:"
hdr_order Date From To Cc
alternative_order text/plain text/html *
auto_view text/html
#bind editor complete-query
#bind editor ^T complete
#bind editor noop

# Gmail-style keyboard shortcuts
macro index,pager y "unset trash\n " "Gmail archive message"
macro index,pager d "set trash=\"imaps://imap.googlemail.com/[GMail]/Bin\"\n " "Gmail delete message"
macro index,pager gi "=INBOX" "Go to inbox"
macro index,pager ga "=[Gmail]/All Mail" "Go to all mail"
macro index,pager gs "=[Gmail]/Starred" "Go to starred messages"
macro index,pager gd "=[Gmail]/Drafts" "Go to drafts"
Save the file.

Now you will need to do one more step so that only you (not counting the admins of the system) can see your email settings and passwords.

$ chmod 700 .muttrc

Step 3: Try It.

Start the program.

$ mutt

It may ask you if you want to save certificates. You should say yes or always. Of course, you have told everyone of your email account. Emails should start coming in.

When you create a new email, you favorite editor will start temporarily leaving mutt till you finish editing the body of your message. Do not let that alarm you. It is normal.

Good luck!

Step 4: Like Using the Command Line?

Here are some other programs that allow you to use your computer from the command line:

Some of my favorite programs are:

alsa sound modules – music and to support speech programs (and voice recording)
Twidge – twitter client
links2 – internet browser
ps2ascii – convert postscript files to text files.
bashpodder – audio podcast collector
alpine sendEmail – email client tools
irssi – interrelay chat
centerim – instant messaging client
vim can be used as and editor or word processor, there are many others.
antiword – for dealing with proprietary word procesing formats.
screen – allows you to easily switch remote sessions
ledger – accounting program
curl wget – web page and file extracting tools
bash – the built in programming language that can be used with awk, sed, sort tr figlet (make your own database or game programs as well as other tools).
ImageMagick suite – manipulate graphics
cadubi tetradraw – ascii drawing programs
opensched – schedule formater.
hnb – notetaking and outlining
moc mplayer aplay ffmpeg – audio tools and players.
nget newbueter – newsreader
pal – calendar/planner program
cdrecord – burn cd’s and back up computer.
ssh and other tools. – network administration/file amangement
espeak festival – voice synthesis (great for having your computer read outloud documents) Who needs a Kindle?
wyrd - calendaring program.

The bottom line is that you can do word processing. spreadsheets. database, email, listen to podcasts or even hear documents spoken. Who could ask for more?

<p>Allright! Handy!</p><p>I've been trying it, but MUTT tells me that my login failed- any ideas why?</p>
<p>Not sure what server you are using but since i did this instructable <br>security has been increased on most mail servers. You have to lower the <br>security level required to log in to use command line email. Had to do <br>that with an account I use. You might try alpine and see what happens. You will need a newer version of must with the latest ssl compiled into it.</p>
<p>That sorted it out, thanks! I had to lower the security level from Gmail's side.</p>

About This Instructable




Bio: computoman.blogspot.com Bytesize articles instead of a trilogy in one post.
More by Computothought:Coffeepot meals Easy sun hat Easy cakes and pies. 
Add instructable to: