Set Up Mutt for TLS SMTP

Discussion in 'Shell / Command Line' started by Eric Hansen, May 14, 2014.

  1. Eric Hansen

    Eric Hansen Moderator Staff Writer

    Messages:
    114
    Likes Received:
    67
    Trophy Points:
    28
    I've always been a fan of minimalistic work, but could never find that one distro to suit me. I wanted one that did everything I could throw at it, and nothing else. Closest thing to that would be making my own, and I just don't have the time for it.

    So, I went back to Arch Linux, with the mindset that Linux is for work, Windows is for play. So far I've ended up triple-booting (Windows, Ubuntu and Arch), and everything has been peachy. But, for work I need to be able to access my email whenever I want. Since I wanted to keep it minimalistic, I chose to go with a CLI email client.

    First I tried sup, and while it looked promising, I need IMAP support, not mbox or Maildir. I then remembered Mutt. I tried it once before, but was not happy with it. I was so used to a GUI that any of its features just wasn't worth it to me.


    I still feel that way somewhat. If I'm going to clean out my inbox I'll most likely use the webmail, but for day to day tasks of sending and replying, I feel pretty confident with Mutt. The only problem was setting up SMTP. I would receive this error:
    Code:
    SSL routines:SSL23_GET_SERVER_HELLO:unknown protocol
    I thought my configuration option of smtps://<user>:<pass>@outlook.com/ would be fine. Nah, there's actually some more trickery I had to set in my .muttrc file:
    Code:
    set smtp_url=smtp://$imap_user:$imap_pass@smtp-mail.outlook.com:587/
    set ssl_force_tls = yes
    set spoolfile = "=INBOX"
    set record = "=Sent Items"
    set postponed = "=Drafts"
    set sort = threads
    set header_cache = ~/.mutt/headercache
    set message_cachedir = ~/.mutt/messagecache
    set imap_check_subscribed
    set imap_keepalive = 300
    set mail_check = 60
    set ssl_starttls = yes
    A little overview:
    • smtp_url - The URL to connect to. $imap_user and $imap_pass are set prior via "set imap_user="…", etc... This line was part of the holy grail for this as I had to specify connection via SMTP (not SMTPS) and on port 587.
    • ssl_force_tls - This forces a connection using TLS even if the protocol doesn't usually support it.
    • spoolfile/record/postponed - These aren't relevant to connecting per-say, but these specify the locations on the IMAP server where my inbox, sent items and not-yet finished emails are stored.
    • sort - I'm a thread-lover, and the default is to just list everything in one column. This makes it a bit more pretty.
    • header_cache/message_cachedir - These are used for caching data (headers and emails themselves) to speed up the process of using Mutt. If you set these, make sure to leave Mutt open for a while it seems...? My experience was lackluster at first but now its pretty fast.
    • imap_check_subscribed - Instead of telling Mutt what to check for, we just tell it to check everything we are subscribed to (which is by default everything in our Outlook).
    • imap_keepalive - Attempt to heartbeat our connection every 300 seconds
    • mail_check- For business I like to know if I got new mail pretty quickly, but anything less than a minute can be considered dangerous. 60 seconds (1 minute) is usually good.
    • ssl_starttls- We don't want to run just SSL, we want to run its big brother TLS! No, but seriously, TLS virtually means SSL...at least from all the reading I've ever done on that. But we enable it.
    From there, sending emails via an Outlook.com account in Mutt works pretty wonderfully.

    Attached Files:

    • slide.png
      slide.png
      File size:
      367.2 KB
      Views:
      59,428
  2. deandownsouth

    deandownsouth New Member

    Messages:
    2
    Likes Received:
    1
    Trophy Points:
    1
    Good post. IMO, mutt reigns supreme as an email client-fast and efficient. Been using it for years (there's even a Win32 port that I've tested!). If you are like me, you'll have several terminals open and I hate having to switch between them and an X client for anything, so I look to use the terminal for as many things as I can. Use with screen (or equiv) for best results.

Share This Page