Update mutt config

This commit is contained in:
2022-10-11 08:30:13 +02:00
parent b07e3c902f
commit ce0180d283
2 changed files with 90 additions and 40 deletions

33
mutt/filter.py Executable file
View File

@@ -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)

View File

@@ -1,21 +1,29 @@
# connection options # encoding
set ssl_force_tls = yes set charset = "utf-8"
# ssl
set ssl_starttls = yes set ssl_starttls = yes
# username and password # configure s/mime support
source "gpg -q -d ~/.mutt/passwords.asc |" source /usr/share/doc/mutt/samples/smime.rc
set imap_user = username@gmail.com set smime_ca_location = /etc/ca-certificates/extracted/tls-ca-bundle.pem
set smtp_url = smtp://username@smtp.gmail.com:587 set smime_default_key = "05408192.0"
set crypt_autosign = no
set crypt_replysign = no
# setup from details # setup directories
set from = username@gmail.com
set realname = "Real Name"
# setup cahce directories
set certificate_file = ~/.mutt/certificates set certificate_file = ~/.mutt/certificates
set tmpdir = ~/.mutt/tmp
set header_cache = ~/.mutt/cache/headers set header_cache = ~/.mutt/cache/headers
set message_cachedir = ~/.mutt/cache/bodies set message_cachedir = ~/.mutt/cache/bodies
set tmpdir = ~/.mutt/tmp
# setup from details
set realname = "<User Name>"
set from = "<user@example.com>"
# authentication
set imap_user = "<user@example.com>"
source "gpg -dq ~/.mutt/<my-encrypted-password>.asc |"
# keep IMAP settings # keep IMAP settings
set imap_keepalive = 300 set imap_keepalive = 300
@@ -23,60 +31,69 @@ set imap_passive = no
set imap_check_subscribed = yes set imap_check_subscribed = yes
# how often to check for new mail (time in seconds) # how often to check for new mail (time in seconds)
set mail_check = 60 set mail_check = 300
# remote gmail folders # default mailbox
set folder = imaps://imap.gmail.com:993 set use_from = yes
set spoolfile = +INBOX set folder = imap://<mail.example.com>
set postponed = +[Gmail]/Drafts set smtp_url = smtp://<mail.example.com>
set spoolfile = "=Inbox"
set record = "=Sent"
set postponed = "=Drafts"
# set sort options # set sort options
set sort = threads set sort = threads
set sort_aux = reverse-last-date-received set sort_aux = reverse-last-date-received
# setup helpers # set mailcap
set mailcap_path = ~/.mutt/mailcap set mailcap_path = ~/.mutt/mailcap
# google address book support # prefer plain text
set query_command = "goobook query '%s'" alternative_order text/plain text/enriched text/html
bind editor "\t" complete-query
# view html emails # view html emails
auto_view text/html 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
set editor='vim' set editor='vim'
# Refresh/Sync # set display filter
bind index U imap-fetch-mail 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 # Set colors to use
color hdrdefault blue black color hdrdefault blue black
color header green black "^From"
color header color111 black "^Subject"
color header brightmagenta black "^Date"
color quoted blue black color quoted blue black
color signature blue black color signature blue black
color attachment green black color attachment green black
color message brightred black color message brightred black
color error brightred black color error brightred black
color indicator black white color indicator white color237
color status brightgreen blue color status black blue
color tree white black color tree white black
color normal white black color normal white black
color markers red black color markers red black
color search white black color search white black
color tilde brightmagenta black color tilde brightmagenta black
color index color33 black ~F color index color33 black "~F"
color index color111 black "~N|~O" color index color111 black "~N|~O"
color index magenta black "~D"
# message headers
color hdrdefault white black
color header white black "^(From)"
color header color111 black "^(Subject)"