Mutt – A command line Email client


02 Feb  

MS Outlook and Thunderbird are undoubted the two most popular email clients that netizans use today. But if you are in GNU/Linux platform, here is another client which you can try (Ofcourse you can use this in Microsoft platform as well, after performing some tweaking).

While installing the solution, it will perform some of the configuration automatically (like Postfix)

 

mutt installation

 

 

postfix config - mutt install

 

Why Commandline?

The reason is quite obvious. Commandline gives you more power. For example, you meddle with all the configuration specific tasks before your send a mail. You can easily configure and add your PGP sign using Mutt. Also, by enabling this feature you can prevent unauthorised users from sending emails. (If you leave you laptop unattended and you have MS outlook running, then anyone near the system can access your inbox and send emails from your account). 

The second fact is that – commandline is cool!

 

Configure your Mutt

 

You need to worry about three files –

  • .muttrc (reading)
  • .fetchmailrc (downloading)
  • .msmtprc(sending)

 

.muttrc File

 

Here is a simple muttrc configuration file:

 

#your username
set pop_user = "your_username”
set pop_delete = no
#your password
set pop_pass = "your_password"
#your host (server)set pop_host = "mail.your_server.com"

 

You may note that the above one is for POP3 emails. If you want to use IMAP, then you need to modify it as:

 

#your IMAP server login
set spoolfile=imaps://imap.server.com/INBOX
#your username
set imap_user=your_username
#your password
set imap_pass=your_password

 

(Novice yours may note that you need to open your favourite editor – say Gedit , vi or nano – and add the above lines to it and save them in your $Home directory)

Since .muttrc is the configuration file for user interface, you can also set your preferred colours in this file itself:

 

color header brightgreen black subject

color hdrdefault brightwhite black

color quoted brightred black

color status black yellow

color indicator default blue

 

Sonetime mutt may display so much of header information. In that case, you can add this line to the config file:

unignore From: To: Cc: Subject: Date:

This will limit the header information

 

You can also set your favourite editor by adding this line:

set editor=nano

(You may note that the default editor is nano itself!)

If you are using Gmail or Yahoo mail, you may have folder in your account. You can have the same thing in mutt as well:

 

set folder = /home/aasisvinayak/Mail

mailboxes /home/aasisvinayak/Main/default

mailboxes /home/aasisvinayak/Mail/buddies

mailboxes /home/aasisvinayak/Mail/readers

mailboxes /home/aasisvinayak/Mail/linux

mailboxes /home/aasisvinayak/Mail/archive

mailboxes /home/aasisvinayak/Mail/spam

 

PGP certificates in mutt

You can use your PGP certificates in your mutt. If you are using a self signed one, then you just need to add that alone (a single) to muttrc file. But in the oyther case you can have:

$ mkdir -pv $HOME/mail/certificates

$ cd $HOME/mail/certificates

$ touch Thawte_Premium_Server_CA.pem

$ touch Equifax_Secure_CA.pem

$ curl –verbose –output mk-ca-bundle.pl \

http://cool.haxx.se/cvs.cgi/*checkout*/curl/lib/mk-ca-bundle.pl?rev=1.10

$ perl mk-ca-bundle.pl

 

.fetchmailrc file

 

For fetching the mail, you may use:

 

poll pop3.your_domain.com
with proto POP3
user 'username@your_domain.com'
there with password 'your_password'
is 'username' here
mda "/usr/bin/procmail -d %T"
options
no keep
ssl
sslcertck
sslcertpath /home/aasisvinayak/mail/certificates/
 

Note: You can make mutt work even without this file. But this is recommended!

And now you can read your emails from mutt

Just open the terminal and type ‘mutt’

 

mutt - startup

It will automatically create the directories.

 

reading mails using mutt

(I’m afraid to show my inbox here :( )

 

 

Sending mail :  .msmtprc file

 

You may add the following lines to the file (you have to create this file):

 

account default             
host smtp.aasisvinayak.com         
port 587                    
from post@aasisvinayak.com    
tls on                      
tls_starttls on             
tls_trust_file /home/aasisvinayak/Mail/certificates/Thawte_Premium_Server_CA.pem

# tls_trust_file /home/aasisvinayak/Mail/certificates/Equifax_Secure_CA.pem

auth on                    
user aasisvinayak       
password my_password         
logfile ~/.msmtp.log

 

(you need to edit the files and replace the username, password and server name)

 

Now you can send mails from mutt (here is a screenshot from mutt’s website)

 

sending mail using mutt

 

Here are few other options you can add to your muttrc file

set sort=threads

(so that you can sort mails as threads)

set record="=Sent"

(setting a sent mail directory)

ignore X-

unignore date

macro index S "|/usr/bin/spamassassin -r^Ms=spam^M"

(enabling spam assassin – a good spam filter)

auto_view text/html

(enabling text/html view)

set mime_forward=ask-no

(setting forwarding options)

set mime_forward_decode

set delete=yes

 

You can also limit the number of emails displayed by adding a ‘limit’ to the muttrc file.

 

Debugging

 

If you getting an error indicating that the mail directory is not found, then you may add this line to your .bashrc file (at the end):

# Sets the Mail Environment Variable

MAIL=/var/spool/mail/aasisvinayak && export MAIL

 

And add the following file to your .procmailrc file:

 

PATH=/bin:/usr/bin:/usr/local/bin

VERBOSE=off 
DEFAULT=/var/spool/mail/aasisvinayak          
MAILDIR=$HOME/Mail           
LOGFILE=$HOME/.procmaillog 
# Recipes below this comment:

:0:

* ^TOmutt-user

mutt

Share and Enjoy:
  • Print
  • Digg
  • Sphinn
  • del.icio.us
  • Facebook
  • Mixx
  • Google Bookmarks
  • Blogplay

Tags: , , , ,


TechBlog on Facebook

Leave a Reply