Have been trying to make mutt work since dapper days, did not quite get it right. After seeing a post in ilugc mailing list today, was determined to try again. It did not take me any more than 5 minutes to get mutt working with exim4. Here are the steps..
[1] install exim4 (+exim4-base, exim4-config, exim4-daemon-light) and mutt
[2] configure exim4 as follows,
$ sudo dpkg-reconfigure exim4-config split configuration into small files ? YES
choose "mail sent my smarthost; received via SMTP or fetchmail
System mail name: localhostIP Address to listen on for incoming SMTP connections: 127.0.0.1
Other destinations for which mail is accepted: <blank>Machines to relay mail to: <blank>
Machine handling outgoing mail for this host (smarthost): smtp.gmail.comHide local mail name in outgoing mail ? NO
Keep number of DNS queries minimal(Dial-On-Deman) ? NO
[3] Now configure the password client
$ sudo vim /etc/exim4/passwd.client gmail-smtp.l.google.com:yourAccountName@gmail.com:y0uRpaSsw0RD
*.google.com:yourAccountName@gmail.com:y0uRpaSsw0RD smtp.gmail.com:yourAccountName@gmail.com:y0uRpaSsw0RD
[4] Specify the port,
$ sudo vim /etc/exim4/conf.d/transport/30_exim4-config_remote_smtp_smarthost # add the following line after the line containing 'host_try_auth ..'
port=587
[5] Add your outgoing email address,
$ sudo vim/etc/exim4/email-address # myuser@localhost: mymail@gmail.com
yourUserName@localhost: yourAccountName@gmail.com
[6] Update the exim4 config
$ sudo update exim4.conf
[7] create a ~/.muttrc and add the following,
# mail check options
set pop_host="pops://username:password@pop.gmail.com:995"
set pop_last
unset pop_delete
# mail send options
set sendmail="/usr/sbin/exim4"
# check for new mail on startup
exec fetch-mail
[8] The necessary configurations are done. Open up a terminal and issue the following command
$ mutt
This will ask you to accept a security certificate and then check your mails. If the configurations are done as given above, you should be able to get the list of mails in your gmail inbox.
If it shows the error “/var/mail/UserName: permission denied (error-13)“, then send a test mail to ‘Username@localhost’. This will create the required /var/mail/UserName and make things work fine.
Happy mutt’ing
Sources:
[1] Gmail and Exim4 - Debian Wiki
[2] Using mutt with Gmail