I love mutt. It is a very flexible and powerful email client but it can be quite hard getting the initial setup right. When I switched it from using pop3 to imap/smtp I had a few problems getting it to work.
First I was getting the following error whenever I tried to send a message:
SMTP session failed: 550 http://www.spamhaus.org/query/bl?ip=my.ip.address
I had my smtp_url in my muttrc set up as follows:
It turns out I needed to add my email address (e.g.
firstname.lastname@example.org) before the server name:
The next problem was after I left mutt for a while and came back to it I was getting the following error:
tls_socket_write (Error in the push function.)
This was caused by the connection to the server timing out. By default mutt polls the server once every 10 minutes. You can fix this by changing the timeout property in muttrc. I changed mine to 60 seconds and now all seems fine:
Another problem is the password. Two passwords are required: imap_pass for retrieving the mails and smtp_pass to send a message. If you leave these blank then mutt will prompt you for them but this means you have to enter the password twice (once when you open mutt and again when you send your first message) and also any changes to your mailbox won’t be synced back to the server unless you’ve already sent a message.
I could store the passwords in the file but don’t like leaving then in plain text in a file on my hard drive. I could encrypt them (as described here http://www.vigasdeep.com/mutt-encrypting-password-with-gnupg/) but then I would need to type a passphrase in to decrypt the password which kind of defeats the object or I could encrypt them with a key with no passphrase but that is not really much more secure than storing in plain text (though I guess that’s what other mail clients must do).
What I did was write a command in the muttrc to read in the password at startup and store in a variable which is then used by both imap_pass and smtp_pass.
set my_pass=`stty -echo; read -p 'Password: ' tmppwd; echo $tmppwd; tmppwd=; stty echo` set imap_pass=$my_pass set smtp_pass=$my_pass
The variable is called “
my_pass” because mutt requires user defined variables to be prefixed with “
my_“. The “
stty -echo” is to stop the user input being displayed while they type the password and “
stty echo” is to turn it back on again.
Finally, I was used to using G to refresh the inbox. Though with it now refreshing every 60 seconds it is not really necessary, but I’m impatient and I’d still like to sometimes be able to check for new emails instantly instead of waiting for a whole minute for them to show. I did it by binding the imap-fetch-mail command to G in my muttrc as follows:
bind index G imap-fetch-mail