From ce0180d2838dfdfb5aaf535c5a6037f793ce37b7 Mon Sep 17 00:00:00 2001 From: Deon Spengler Date: Tue, 11 Oct 2022 08:30:13 +0200 Subject: [PATCH] Update mutt config --- mutt/filter.py | 33 +++++++++++++++++ mutt/muttrc | 97 +++++++++++++++++++++++++++++--------------------- 2 files changed, 90 insertions(+), 40 deletions(-) create mode 100755 mutt/filter.py diff --git a/mutt/filter.py b/mutt/filter.py new file mode 100755 index 0000000..a1b0b23 --- /dev/null +++ b/mutt/filter.py @@ -0,0 +1,33 @@ +#!/usr/bin/env python3 +import re +import sys + +# Read data from stdin +data = sys.stdin.read() + +# Remove unwanted text +data = re.sub(r'\[-- Autoview.*--\]', '', data) +data = re.sub(r'\[-- Attachment #[0-9] --\]', '', data) +data = re.sub(r'\[cid\]', '', data) +data = re.sub(r'\[-- application.*unsupported.*--\]', '', data) +data = re.sub(r'\[-- image.*unsupported.*--\]', '', data) +data = re.sub(r'\[-- Type.*--\]', '', data) + +# replace text for signed and encrypted email +data = re.sub(r'\[-- OpenSSL.*\nVerification successful\n.*', + '[-- Signed Email: Verification successful --]', data) +data = re.sub(r'\[-- The following data is S/MIME encrypted --\]', + '[-- Encrypted Email: S/MIME --]', data) +data = re.sub(r'\[-- The following data is signed --\]', '', data) +data = re.sub(r'\[-- End of signed data --\]', '', data) +data = re.sub(r'\[-- End of S/MIME encrypted data. --\]', '', data) + +# Add line for quoted email +data = re.sub(r'(?<=\n)(From:.*)', '_'*80 + r'\n\1', data) + +# clean up multiple blanks lines +data = re.sub(r'.*\n', '', data) +data = re.sub(r'\n\s*\n', r'\n\n', data) + +# Output filtered text to stdout +sys.stdout.write(data) diff --git a/mutt/muttrc b/mutt/muttrc index 5e47f1f..b5559d9 100644 --- a/mutt/muttrc +++ b/mutt/muttrc @@ -1,21 +1,29 @@ -# connection options -set ssl_force_tls = yes +# encoding +set charset = "utf-8" + +# ssl set ssl_starttls = yes -# username and password -source "gpg -q -d ~/.mutt/passwords.asc |" -set imap_user = username@gmail.com -set smtp_url = smtp://username@smtp.gmail.com:587 +# configure s/mime support +source /usr/share/doc/mutt/samples/smime.rc +set smime_ca_location = /etc/ca-certificates/extracted/tls-ca-bundle.pem +set smime_default_key = "05408192.0" +set crypt_autosign = no +set crypt_replysign = no -# setup from details -set from = username@gmail.com -set realname = "Real Name" - -# setup cahce directories +# setup directories set certificate_file = ~/.mutt/certificates +set tmpdir = ~/.mutt/tmp set header_cache = ~/.mutt/cache/headers set message_cachedir = ~/.mutt/cache/bodies -set tmpdir = ~/.mutt/tmp + +# setup from details +set realname = "" +set from = "" + +# authentication +set imap_user = "" +source "gpg -dq ~/.mutt/.asc |" # keep IMAP settings set imap_keepalive = 300 @@ -23,60 +31,69 @@ set imap_passive = no set imap_check_subscribed = yes # how often to check for new mail (time in seconds) -set mail_check = 60 +set mail_check = 300 -# remote gmail folders -set folder = imaps://imap.gmail.com:993 -set spoolfile = +INBOX -set postponed = +[Gmail]/Drafts +# default mailbox +set use_from = yes +set folder = imap:// +set smtp_url = smtp:// +set spoolfile = "=Inbox" +set record = "=Sent" +set postponed = "=Drafts" # set sort options set sort = threads set sort_aux = reverse-last-date-received -# setup helpers +# set mailcap set mailcap_path = ~/.mutt/mailcap -# google address book support -set query_command = "goobook query '%s'" -bind editor "\t" complete-query +# prefer plain text +alternative_order text/plain text/enriched text/html # view html emails auto_view text/html -# index_format -set index_format="%3C %Z %[%b %d %H:%M] - %-22.22L %s" - -# Header Options ------------------------------------- -ignore * # ignore all headers -unignore from: to: cc: date: subject: # show only these -unhdr_order * # some distros order things by default -hdr_order from: to: cc: date: subject: # and in this order - # set editor set editor='vim' -# Refresh/Sync -bind index U imap-fetch-mail +# set display filter +set display_filter="~/.mutt/filter.py" + +# ldap address book +set query_command = "~/.mutt/ldapbook.py '%s'" +bind editor "\t" complete-query + +# pager key binding +bind pager j next-line +bind pager k previous-line + +# index_format +set index_format="%3C %Z %[%b %d %H:%M] - %-22.22L %s" + +# header Options +ignore * +unignore from: to: cc: date: subject: +unhdr_order * +hdr_order from: to: cc: date: subject: # Set colors to use color hdrdefault blue black +color header green black "^From" +color header color111 black "^Subject" +color header brightmagenta black "^Date" color quoted blue black color signature blue black color attachment green black color message brightred black color error brightred black -color indicator black white -color status brightgreen blue +color indicator white color237 +color status black blue color tree white black color normal white black color markers red black color search white black color tilde brightmagenta black -color index color33 black ~F +color index color33 black "~F" color index color111 black "~N|~O" - -# message headers -color hdrdefault white black -color header white black "^(From)" -color header color111 black "^(Subject)" +color index magenta black "~D"