mutt (send attachment / file, .muttrc)
send attachment / file
- echo "foo" | mutt -s "subject" me@example.com -a /home/me/file.txt
Note: the recipient must be given before the "-a" option, otherwise mutt thinks the email address is another file.
open a dovecot mailbox/folder
- mutt -f /var/vmail/example.com/joe/
.muttrc
vi ~/.muttrc
# o = sort, then d for date, then "z" for reverse
# = = jump to newest message
# sort by reverse date
#set sort=threads
set sort_aux=reverse-date
#jump to top (don't remember cursor)
set move=yes
# =============================================================
# Mutt Spam Configuration
# Display X-Spam-Score in index and color by X-Spam-Level
# =============================================================
# --- For IMAP: Request spam headers from server ---
# (Only needed if using IMAP; local/POP folders have headers already)
set imap_headers = "X-SPAM-SCORE X-SPAM-LEVEL"
# --- Extract spam score for display using %H ---
# Regex captures the numeric score from "X-Spam-Score: 5.307"
spam "X-Spam-Score: ([0-9.]+)" "%1"
# --- Index format with spam score column ---
# %H displays the extracted spam tag (the score)
# Use %?H?%5.5H& ? to show score or spaces if not present
set index_format = "%4C %Z %{%b %d %H:%M} %-22.22F %?H?%5.5H& ? %-40.40s"
# --- Spam coloring based on X-Spam-Level (asterisks) ---
# The ~h pattern matches headers; regex must match the header line
# 1-3 stars ? yellow (low/medium spam score)
color index yellow default "~h 'X-Spam-Level: \\*$'"
color index yellow default "~h 'X-Spam-Level: \\*\\*$'"
color index yellow default "~h 'X-Spam-Level: \\*\\*\\*$'"
# 4+ stars ? red (high spam score)
# No $ anchor - matches 4 or more asterisks
color index red default "~h 'X-Spam-Level: \\*\\*\\*\\*'"
# =============================================================
# IMPORTANT NOTES:
# =============================================================
# 1. If using header cache and %H shows nothing or shows stale data:
# - Close mutt
# - Delete your header cache files (e.g., rm -rf ~/.mutt/cache/*)
# - Restart mutt
#
# 2. The spam command regex must match your exact header format.
# Your headers look like:
# X-Spam-Score: 5.307
# X-Spam-Level: *****
#
# 3. For IMAP, mutt only fetches default headers. The imap_headers
# setting tells mutt to also fetch spam headers. Without this,
# the spam command and ~h patterns won't work until you open
# each message individually.
#
# 4. Color rules are processed in order - later rules override earlier.
# So a message with 5 stars will match both yellow (3 stars) and
# red (4+ stars), but red wins because it comes last.
# =============================================================

