Mutt command line email client

Mutt is completely configured through a config file named .muttrc which has to reside in your home directory. It offers a lot of configuration settings which can't be handled in this article. You can either read the man page of mutt (respectively muttrc) or you can use the online configurator which creates a configuration based on the selected values.

For a simple running configuration on our infrastructure, read below.

Password - comfort versus security

In cases where mutt needs your user credentials, we recommend to use the secure (but not comfortable) way. This means that you should NOT add any passwords into the configuration file and instead always enter the password manually whenever you are asked for it. We know, that it is not very comfortable to re-enter the password over and over again. But since the password is stored in plaintext, everyone which gains access to your .muttrc configuration file, also gains access to your NETHZ account.

But if you think you can handle that, we also describe the variant to store the password.

Minimal Configuration

  1. Open (or create) ~/.muttrc with your favorite editor

  2. Start with the IMAP Settings and specify the default IMAP location of your mailboxes. When this path is set, you can later reference to it with "=". So instead of writing imaps://imap.ee.ethz.ch/INBOX/Trash you can use =Trash.

    # IMAP Settings
    # #############
    # Specifies the default IMAP location of your mailboxes which can then be used as "=".
    set folder="imaps://imap.ee.ethz.ch/INBOX"
  3. Next define your IMAP username (and if you know what you are doing) the IMAP password. /!\ Again, be aware that this configfile and its password can be potentially read by others, therefore we DO NOT recommend to set a password! If you omit any of these settings, mutt asks you for them everytime it needs them. Replace USERNAME and PASSWORD with your NETHZ Username and NETHZ Password!

    # Uncomment to set a default IMAP Username and password. Be AWARE that a password in
    # here is NOT SECURE and can be potentially read!
    set imap_user=USERNAME
    #set imap_pass="YOUR_PASSWORD"
  4. By configuring the spoolfile we decide which folder should be shown at startup. If you leave the default below, mutt starts by showing your Inbox.
    # Define which mailbox should be showed at startup. "=" means, use the same content
    # as defined in folder. BTW! Whenever you use c to change into a folder (e.g. =Sent
    # to change into the Sent folder), use = to return to the INBOX!
    set spoolfile="="
  5. When working with emails you need directories to save your drafts, sent mails or your trash. We define them below on the IMAP Server.
    # Define which folders to use for Drafts, Sent Mails, Trash
    set postponed="=Drafts"
    set record="=Sent"
    set trash="=Trash"
  6. Now let us continue with the SMTP Section. First we recommend to configure your FROM Address so that others receiving your email do not see something like username@hostname as a sender address. /!\ make sure to enter an existing mail address in here or others are not able to reply to your message! We recommend to use the format Firstname Lastname <address@institute>. So if for example, you are from TIK, then you could use something like "Peter Muster <p.muster@tik.ee.ethz.ch>" as an example

    # SMTP Settings
    # #############
    # Configure a correct FROM address. Common practice is to use the
    # format "Firstname Lastname <address@institute>"
    set from="Firstname Lastname <address@institute>"
  7. To connect to our smtp server and to send your emails, you need at least to define your username. Uncomment the second line instead, if you would like to add your password into the configurations file.
    # Uncomment the first line, if you want to enter your password every time you
    # send an email, uncomment the second line to add it in here. But be AWARE that a
    # password in here is NOT SECURE and can be potentially read!
    #
    set smtp_url="smtp://USERNAME@smtp.ee.ethz.ch:587"
    #set smtp_url="smtp://USERNAME:PASSWORD@smtp.ee.ethz.ch:587"
  8. Below are a few settings which CAN but DO NOT HAVE TO be enabled in your configuration file. Uncomment any of them as you like.
    # Additional Settings
    # ###################
    #
    # Improve speed when opening POP, IMAP or Maildir folders.
    set header_cache="${HOME}/.mutt_header_cache"
    
    # activate TLS if available on the server
    set ssl_starttls=yes
    
    # always use SSL encryption when connecting to a server
    set ssl_force_tls=yes
    
    # use an arrow to highlight current line
    #set arrow_cursor=yes
    
    # poll subscribed mailboxes for new mail
    #set imap_check_subscribed
    #set mail_check=60
    #set timeout=10
    #unset imap_passive


CategoryMAIL

Email/MailClient/Mutt (last edited 2020-09-10 14:48:59 by gfreudig)