From 41effffb3b46f1cc76ae800768c623b347e2f0a7 Mon Sep 17 00:00:00 2001 From: tsxv478 Date: Wed, 19 Jun 2024 07:57:46 +0300 Subject: Email templates --- .config/msmtp/config | 12 ++++ .config/mutt/accounts/example.muttrc | 40 ++++++++++++ .config/mutt/gpg.rc | 116 +++++++++++++++++++++++++++++++++++ .config/mutt/mailcap | 10 +++ .config/mutt/muttrc | 113 ++++++++++++++++++++++++++++++++++ .config/mutt/switch.muttrc | 5 ++ .mbsyncrc | 24 ++++++++ 7 files changed, 320 insertions(+) create mode 100644 .config/msmtp/config create mode 100644 .config/mutt/accounts/example.muttrc create mode 100644 .config/mutt/gpg.rc create mode 100644 .config/mutt/mailcap create mode 100644 .config/mutt/muttrc create mode 100644 .config/mutt/switch.muttrc create mode 100644 .mbsyncrc diff --git a/.config/msmtp/config b/.config/msmtp/config new file mode 100644 index 0000000..bfe09fa --- /dev/null +++ b/.config/msmtp/config @@ -0,0 +1,12 @@ +account @ +user @ +from @ +host mail. +port 587 +auth on +passwordeval "pass mail" +tls on +tls_starttls on +tls_certcheck on +tls_trust_file /etc/ssl/certs/ca-certificates.crt +logfile ~/.config/msmtp/msmtp.log diff --git a/.config/mutt/accounts/example.muttrc b/.config/mutt/accounts/example.muttrc new file mode 100644 index 0000000..3f561c6 --- /dev/null +++ b/.config/mutt/accounts/example.muttrc @@ -0,0 +1,40 @@ +# vim: filetype=muttrc + +set realname = "" +set from = "@" +set sendmail = "msmtp -a @" +alias me <@> +set folder = "$HOME/.local/share/mail/@" +set header_cache = "$HOME/.cache/mutt/@/headers" +set message_cachedir = "$HOME/.cache/mutt/@/bodies" +set mbox_type = Maildir +set hostname = "" +source $HOME/.config/mutt/switch.muttrc +set spoolfile = +INBOX +set record = +Sent +set postponed = +Drafts +set trash = +Trash +mailboxes "=INBOX" "=Sent" "=Drafts" "=Archive" "=Junk" "=Trash" + +macro index,pager gi "=INBOX" "go to inbox" +macro index,pager Mi ";=INBOX" "move mail to inbox" +macro index,pager Ci ";=INBOX" "copy mail to inbox" +macro index,pager gs "=Sent" "go to sent" +macro index,pager Ms ";=Sent" "move mail to sent" +macro index,pager Cs ";=Sent" "copy mail to sent" +macro index,pager gd "=Drafts" "go to drafts" +macro index,pager Md ";=Drafts" "move mail to drafts" +macro index,pager Cd ";=Drafts" "copy mail to drafts" +macro index,pager ga "=Archive" "go to archive" +macro index,pager Ma ";=Archive" "move mail to archive" +macro index,pager Ca ";=Archive" "copy mail to archive" +macro index,pager gj "=Junk" "go to junk" +macro index,pager Mj ";=Junk" "move mail to junk" +macro index,pager Cj ";=Junk" "copy mail to junk" +macro index,pager gt "=Trash" "go to trash" +macro index,pager Mt ";=Trash" "move mail to trash" +macro index,pager Ct ";=Trash" "copy mail to trash" + +macro index o "mbsync -V @" "run mbsync to sync @" +macro index \eg "unset wait_keygpg --list-secret-keys; printf 'Enter email ID of user to publish: '; read eID; printf 'Enter fingerprint of GPG key to publish: '; read eFGPT; /usr/local/libexec/gpg-wks-client --create \$eFGPT \$eID | msmtp --read-envelope-from --read-recipients -a @" "publish GPG key to WKS provider" +macro index \eh "/usr/local/libexec/gpg-wks-client --receive | msmtp --read-envelope-from --read-recipients -a @" "confirm GPG publication" diff --git a/.config/mutt/gpg.rc b/.config/mutt/gpg.rc new file mode 100644 index 0000000..4da9411 --- /dev/null +++ b/.config/mutt/gpg.rc @@ -0,0 +1,116 @@ +# vim: filetype=muttrc + +# -*-muttrc-*- +# +# Command formats for gpg. +# +# Some of the older commented-out versions of the commands use gpg-2comp from: +# http://70t.de/download/gpg-2comp.tar.gz +# +# %p The empty string when no passphrase is needed, +# the string "PGPPASSFD=0" if one is needed. +# +# This is mostly used in conditional % sequences. +# +# %f Most PGP commands operate on a single file or a file +# containing a message. %f expands to this file's name. +# +# %s When verifying signatures, there is another temporary file +# containing the detached signature. %s expands to this +# file's name. +# +# %a In "signing" contexts, this expands to the value of the +# configuration variable $pgp_sign_as, if set, otherwise +# $pgp_default_key. You probably need to +# use this within a conditional % sequence. +# +# %r In many contexts, mutt passes key IDs to pgp. %r expands to +# a list of key IDs. + + +# Section A: Key Management + +# The default key for encryption (used by $pgp_self_encrypt and +# $postpone_encrypt). +# +# It will also be used for signing unless $pgp_sign_as is set to a +# key. +# +# Unless your key does not have encryption capability, uncomment this +# line and replace the keyid with your own. +# +# set pgp_default_key="0x12345678" + +# If you have a separate signing key, or your key _only_ has signing +# capability, uncomment this line and replace the keyid with your +# signing keyid. +# +# set pgp_sign_as="0x87654321" + + +# Section B: Commands + +# Note that we explicitly set the comment armor header since GnuPG, when used +# in some localiaztion environments, generates 8bit data in that header, thereby +# breaking PGP/MIME. + +# decode application/pgp +set pgp_decode_command="gpg --status-fd=2 %?p?--passphrase-fd 0? --no-verbose --quiet --batch --output - %f" + +# verify a pgp/mime signature +set pgp_verify_command="gpg --status-fd=2 --no-verbose --quiet --batch --output - --verify %s %f" + +# decrypt a pgp/mime attachment +set pgp_decrypt_command="gpg --status-fd=2 %?p?--passphrase-fd 0? --no-verbose --quiet --batch --output - %f" + +# create a pgp/mime signed attachment +# set pgp_sign_command="gpg-2comp --comment '' --no-verbose --batch --output - %?p?--passphrase-fd 0? --armor --detach-sign --textmode %?a?-u %a? %f" +set pgp_sign_command="gpg --no-verbose --batch --quiet --output - %?p?--passphrase-fd 0? --armor --detach-sign --textmode %?a?-u %a? %f" + +# create a application/pgp signed (old-style) message +# set pgp_clearsign_command="gpg-2comp --comment '' --no-verbose --batch --output - %?p?--passphrase-fd 0? --armor --textmode --clearsign %?a?-u %a? %f" +set pgp_clearsign_command="gpg --no-verbose --batch --quiet --output - %?p?--passphrase-fd 0? --armor --textmode --clearsign %?a?-u %a? %f" + +# create a pgp/mime encrypted attachment +# set pgp_encrypt_only_command="pgpewrap gpg-2comp -v --batch --output - --encrypt --textmode --armor --always-trust -- -r %r -- %f" +set pgp_encrypt_only_command="pgpewrap gpg --batch --quiet --no-verbose --output - --encrypt --textmode --armor --always-trust -- -r %r -- %f" + +# create a pgp/mime encrypted and signed attachment +# set pgp_encrypt_sign_command="pgpewrap gpg-2comp %?p?--passphrase-fd 0? -v --batch --output - --encrypt --sign %?a?-u %a? --armor --always-trust -- -r %r -- %f" +set pgp_encrypt_sign_command="pgpewrap gpg %?p?--passphrase-fd 0? --batch --quiet --no-verbose --textmode --output - --encrypt --sign %?a?-u %a? --armor --always-trust -- -r %r -- %f" + +# import a key into the public key ring +set pgp_import_command="gpg --no-verbose --import %f" + +# export a key from the public key ring +set pgp_export_command="gpg --no-verbose --export --armor %r" + +# verify a key +set pgp_verify_key_command="gpg --verbose --batch --fingerprint --check-sigs %r" + +# read in the public key ring +# note: the second --with-fingerprint adds fingerprints to subkeys +set pgp_list_pubring_command="gpg --no-verbose --batch --quiet --with-colons --with-fingerprint --with-fingerprint --list-keys %r" + +# read in the secret key ring +# note: the second --with-fingerprint adds fingerprints to subkeys +set pgp_list_secring_command="gpg --no-verbose --batch --quiet --with-colons --with-fingerprint --with-fingerprint --list-secret-keys %r" + +# fetch keys +# set pgp_getkeys_command="pkspxycwrap %r" + +# pattern for good signature - may need to be adapted to locale! + +# set pgp_good_sign="^gpgv?: Good signature from " + +# OK, here's a version which uses gnupg's message catalog: +# set pgp_good_sign="`gettext -d gnupg -s 'Good signature from "' | tr -d '"'`" + +# This version uses --status-fd messages +set pgp_good_sign="^\\[GNUPG:\\] GOODSIG" + +# pattern to verify a decryption occurred +# This is now deprecated by pgp_check_gpg_decrypt_status_fd: +# set pgp_decryption_okay="^\\[GNUPG:\\] DECRYPTION_OKAY" +set pgp_check_gpg_decrypt_status_fd + diff --git a/.config/mutt/mailcap b/.config/mutt/mailcap new file mode 100644 index 0000000..5564f32 --- /dev/null +++ b/.config/mutt/mailcap @@ -0,0 +1,10 @@ +text/plain; $EDITOR %s; +text/html; lynx -assume_charset=%{charset} -display_charset=utf-8 -dump %s -width=150; nametemplate=%s.html; copiousoutput; +# text/html; elinks -dump -dump-charset %{charset} -dump-width 150 -force-html; copiousoutput; +# text/html; w3m -I %{charset} -T text/html; copiousoutput; +image/*; nsxiv %s ; +audio/*; mpv %s ; +video/*; setsid -f mpv --really-quiet %s &; copiousoutput; +application/pdf; zathura %s ; +application/pgp-encrypted; gpg -d '%s'; copiousoutput; +application/pgp-keys; gpg --import '%s'; copiousoutput; diff --git a/.config/mutt/muttrc b/.config/mutt/muttrc new file mode 100644 index 0000000..0bfa72a --- /dev/null +++ b/.config/mutt/muttrc @@ -0,0 +1,113 @@ +set date_format="%d/%m/%Y, %H:%M" +set index_format="%2C %Z %?X?A& ? %D %-15.15F %s (%-4.4c)" +set sort = reverse-date +set forward_format = "Fwd: %s" +set forward_quote = yes +set reverse_name = yes +set wrap = 150 +set wait_key = no +set sleep_time = 0 +set markers = no +set mark_old = no +set fast_reply = yes +set include = yes +set fcc_attach = yes +set mime_forward = yes +set mail_check = 60 +set mail_check_stats = yes +set rfc2047_parameters = yes +# set edit_headers = yes +# set menu_scroll = yes +set mime_type_query_command = "file --mime-type -b %s" +set query_command = "abook --mutt-query '%s'" +set smtp_authenticators = 'gssapi:login' +set send_charset = "utf-8" +set mailcap_path = ~/.config/mutt/mailcap:$mailcap_path +set sidebar_visible = yes +set sidebar_width = 25 +set sidebar_short_path = yes +set sidebar_next_new_wrap = yes +set sidebar_divider_char = "│" +set sidebar_format = "%B%?F? [%F]?%* %?N?%N/?%S " +auto_view text/html +auto_view application/pgp-encrypted +alternative_order text/plain text/enriched text/html + +bind index,pager i noop +bind index,pager g noop +bind index,pager M noop +bind index,pager C noop +bind index \Cf noop +bind index gg first-entry +bind index j next-entry +bind index k previous-entry +bind attach view-mailcap +bind attach l view-mailcap +bind editor noop +bind index G last-entry +bind index gg first-entry +bind pager,attach h exit +bind pager j next-line +bind pager k previous-line +bind pager l view-attachments +bind index D delete-message +bind index U undelete-message +bind index L limit +bind index h noop +bind index l display-message +bind index,query tag-entry +macro browser h '..' "Go to parent folder" +bind browser l select-entry +bind browser gg top-page +bind browser G bottom-page +bind pager gg top +bind pager G bottom +bind index,pager,browser d half-down +bind index,pager,browser u half-up +bind index,pager S sync-mailbox +bind index,pager R group-reply +bind index \031 previous-undeleted +bind index \005 next-undeleted +bind pager \031 previous-line +bind pager \005 next-line +bind editor complete-query +bind index,pager \Ck sidebar-prev +bind index,pager \Cj sidebar-next +bind index,pager \Co sidebar-open +bind index,pager \Cp sidebar-prev-new +bind index,pager \Cn sidebar-next-new +bind index,pager B sidebar-toggle-visible + +#set crypt_autosign = yes +#set crypt_opportunistic_encrypt = yes +#set pgp_self_encrypt = yes +#set pgp_default_key = 'your@gpgemailaddre.ss' + +macro attach 'V' "iconv -c --to-code=UTF8 > ~/.cache/mutt/mail.html$BROWSER ~/.cache/mutt/mail.html >/dev/null 2>&1" +macro index \Cf "unset wait_keyprintf 'Enter a search term to find with notmuch: '; read x; echo \$x >~/.cache/mutt_terms~i \"\`notmuch search --output=messages \$(cat ~/.cache/mutt_terms) | head -n 600 | perl -le '@a=<>;s/\^id:// for@a;$,=\"|\";print@a' | perl -le '@a=<>; chomp@a; s/\\+/\\\\+/ for@a;print@a' \`\"" "show only messages matching a notmuch pattern" +macro index A "all\n" "show all messages (undo limit)" +macro index,pager i1 'source ~/.config/mutt/accounts/example.muttrc!;' "switch to example" + +color index brightcyan default "~N" +color index brightblue default "~T" +color index brightmagenta default ~F +color sidebar_new brightcyan default +color sidebar_divider yellow default +color sidebar_indicator brightblack blue +color hdrdefault yellow default +color quoted blue default +color signature blue default +color attachment cyan default +color prompt brightyellow default +color message brightgreen default +color error brightwhite default +color indicator brightblack cyan +color status brightblack yellow +color tree white default +color normal default default +color markers red default +color search white default +color tilde brightgreen default + +source ~/.config/mutt/gpg.rc +source ~/.config/mutt/accounts/example.muttrc diff --git a/.config/mutt/switch.muttrc b/.config/mutt/switch.muttrc new file mode 100644 index 0000000..f11f2f4 --- /dev/null +++ b/.config/mutt/switch.muttrc @@ -0,0 +1,5 @@ +unset hostname +unmy_hdr Organization +unmailboxes * +unalternates * +unset signature diff --git a/.mbsyncrc b/.mbsyncrc new file mode 100644 index 0000000..4262714 --- /dev/null +++ b/.mbsyncrc @@ -0,0 +1,24 @@ +IMAPStore @-remote +Host mail. +Port 993 +User @ +PassCmd "pass mail" +AuthMechs LOGIN +SSLType IMAPS +CertificateFile /etc/ssl/certs/ca-certificates.crt + +MaildirStore @-local +Subfolders Verbatim +Path ~/.local/share/mail/@/ +Inbox ~/.local/share/mail/@/INBOX + +Channel @ +Expunge Both +Far :@-remote: +Near :@-local: +Patterns * +Create Both +SyncState * +MaxMessages 0 +ExpireUnread no +### End profile ### -- cgit v1.2.3