User Tools

Site Tools


terminal:mutt

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revision Previous revision
Next revision
Previous revision
terminal:mutt [2021/04/03 23:34]
nanodano [Install]
terminal:mutt [2021/05/19 00:24] (current)
nanodano
Line 2: Line 2:
  
 [[http://www.mutt.org|Mutt]] is a terminal and CLI email client for sending, receiving, and reading email. It uses vim-like keybindings and has minimal requirements. If you want to use a GUI email client, try [[https://www.thunderbird.net/|Thunderbird]]. You might also be interested in [[https://neomutt.org|Neomutt]]. [[http://www.mutt.org|Mutt]] is a terminal and CLI email client for sending, receiving, and reading email. It uses vim-like keybindings and has minimal requirements. If you want to use a GUI email client, try [[https://www.thunderbird.net/|Thunderbird]]. You might also be interested in [[https://neomutt.org|Neomutt]].
 +
 +<html>
 +<iframe width="560" height="315" src="https://www.youtube.com/embed/jTPa7vWNAS8" title="YouTube video player" frameborder="0" allow="accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture" allowfullscreen></iframe>
 +</html>
  
 ===== Setup ===== ===== Setup =====
Line 18: Line 22:
  
 **Build from source** **Build from source**
 +
 +Here are the steps to build from source. You can download the sources from [[http://www.mutt.org]].
  
 <code bash> <code bash>
Line 36: Line 42:
 <code bash> <code bash>
 brew install openssl brew install openssl
-export LDFLAGS="-L/usr/local/opt/openssl/lib" export CPPFLAGS="-I/usr/local/opt/openssl/include"+export LDFLAGS="-L/usr/local/opt/openssl/lib" 
 +export CPPFLAGS="-I/usr/local/opt/openssl/include"
 # Then run ./configure with the options. # Then run ./configure with the options.
 </code> </code>
Line 74: Line 81:
 # Sending mail with SMTPS # Sending mail with SMTPS
 # TLS is  `smtps://` and port 465 # TLS is  `smtps://` and port 465
-# non-TLS `smtp:// and port 587+# non-TLS `smtp:// and port 25 or 587
 set smtp_url = "smtps://nanodano@devdungeon.com@mail.devdungeon.com:465/" set smtp_url = "smtps://nanodano@devdungeon.com@mail.devdungeon.com:465/"
 set smtp_pass = "password" set smtp_pass = "password"
Line 81: Line 88:
 # TLS is  `imaps://` with port 993 # TLS is  `imaps://` with port 993
 # non-TLS `imap:// with port 143 # non-TLS `imap:// with port 143
 +# Omit password, and it will prompt you
 set imap_user = "nanodano@devdungeon.com" set imap_user = "nanodano@devdungeon.com"
 set imap_pass = "password" set imap_pass = "password"
Line 100: Line 108:
 # or try `set sort = threads` # or try `set sort = threads`
  
-# Colors +# Colors (general)
-# set default+
 color normal     white         default color normal     white         default
 color status     cyan          default color status     cyan          default
Line 191: Line 198:
 To change sort order interactively, use '':set sort=last-date-received'' or '':set sort=reverse-last-date-received''. To change sort order interactively, use '':set sort=last-date-received'' or '':set sort=reverse-last-date-received''.
  
-===== Check multiple mailboxes ===== 
  
-//Incomplete. To Do.// 
  
 ===== Check other folders ===== ===== Check other folders =====
Line 199: Line 204:
 To check other folders besides your basic inbox, you can manually set the mailbox names in ''.muttrc'' or you can have it automatically fetch all folders from the IMAP server. You can also show the sidebar to see what folder you're currently looking in. To check other folders besides your basic inbox, you can manually set the mailbox names in ''.muttrc'' or you can have it automatically fetch all folders from the IMAP server. You can also show the sidebar to see what folder you're currently looking in.
  
-<code>+<code bash>
 # In your ~/.muttrc # In your ~/.muttrc
  
Line 213: Line 218:
  
 To change what folder you're looking in, press the ''y'' key. To change what folder you're looking in, press the ''y'' key.
 +
 +
 +===== Check multiple email accounts =====
 +
 +One way to do this is have separate ''.muttrc'' files for different accounts, and then specify the the rc file to use at runtime:
 +
 +<code bash>
 +mutt -F ~/.muttrc.account2
 +</code>
 +
 +If you want to include a generic rc file within your account specific file, use ''source'' to load the other scripts source. For example:
 +
 +<code bash .muttrc.account2>
 +# ~/.muttrc.account2
 +
 +# Load generic colors/preferences
 +source ~/.muttrc
 +
 +### Account specific settings ###
 +set from = "john.doe@example.com"
 +set realname = "John Doe"
 +
 +set smtp_url = "smtps://nanodano@devdungeon.com@mail.devdungeon.com:465/"
 +set smtp_pass = "password"
 +# Omit password, and it will prompt you
 +set imap_user = "nanodano@devdungeon.com"
 +set imap_pass = "password"
 +set folder = "imaps://mail.devdungeon.com:993"
 +set spoolfile = "+INBOX"
 +</code>
 +
 +I read that there is a way to map a key-bind to toggle switching between mailboxes like this but I'm not sure how. Press ''?'' in mutt to pull up the commands. Probably something like "load rc file" followed by "sync mailbox imap".
 +
 +You can also use the Dialog tool. Refer to the page: [[other:dialog_terminal_tui|Dialog - Terminal Menu Creator]], but here is a simple example:
 +
 +<code bash email.sh>
 +#!/bin/bash
 +# Present a list of accounts to choose from
 +
 +exit_code=0
 +
 +exec 3>&1
 +
 +# Go back to the menu after quitting mutt
 +while [ $exit_code -eq 0 ]
 +do
 +  # Generate a menu of accounts
 +  choice=$(dialog --menu "Open mail" 40 40 40 \
 +           "~/.muttrc.1" "Account 1" \
 +           "~/.muttrc.2" "Account 2" \
 +           2>&1 1>&3)
 +  exit_code=$?
 +  if [ $exit_code -eq 0 ]
 +  then
 +    mutt -F "$choice"
 +  fi
 +done
 +
 +exec 3>&-
 +</code>
 +
 +
 ===== Use PGP encryption ===== ===== Use PGP encryption =====
  
 //Incomplete. To Do.// //Incomplete. To Do.//
terminal/mutt.1617492879.txt.gz · Last modified: 2021/04/03 23:34 by nanodano