mail: overhaul email config

This commit is contained in:
lelgenio 2022-02-03 23:09:49 -03:00
parent cfb60eb797
commit 1c0d53aa21
12 changed files with 94 additions and 45 deletions

View File

@ -37,14 +37,22 @@ variables:
mail:
personal:
user: lelgenio
mail: disroot.org
from: Leonardo Eugênio
user: lelgenio@disroot.org
imap: disroot.org
smtp: disroot.org
pass: disroot.org
work:
from: Leonardo Eugênio
user: leonardo@wopus.com.br
mail: wopus.com.br
pass: wopus_email
imap: imap.wopus.com.br
smtp: smtp.wopus.com.br
pass: Work/wopus_email
nextcloud:
user: lelgenio
host: cloud.disroot.org
pass: disroot.org
###############################################################
profiles:
@ -202,7 +210,7 @@ dynvariables:
accent_color_name: test -n "$_ACCENT_COLOR" && echo "$_ACCENT_COLOR" || echo red
firefox_profile: cat ~/.mozilla/firefox/profiles.ini | grep '^Default' | head -n1 | cut -d= -f2
deezer_arl: pass show Entertainment/Deezer | awk '/^arl:/ {print $2}'
main_password: _pass_get "{{@@ mail.personal.mail @@}}" | base64
main_password: _pass_get "{{@@ mail.personal.pass @@}}" | base64
###############################################################
actions:
@ -250,6 +258,7 @@ actions:
lnMail: |
ln -fs ~/.config/neomutt/mbsyncrc ~/.mbsyncrc
ln -fs ~/.config/neomutt/urlview ~/.urlview
ln -fs ~/.config/neomutt/msmtprc ~/.msmtprc
ranger_icons:
git clone

View File

@ -53,9 +53,9 @@ fileext = ".vcf"
[storage contacts_remote]
type = "carddav"
url = "https://cloud.{{@@ mail.personal.mail @@}}/remote.php/dav/addressbooks/users/{{@@ mail.personal.user @@}}/"
username = "{{@@ mail.personal.user @@}}@{{@@ mail.personal.mail @@}}"
password.fetch = [ "command", "_pass_get", "{{@@ mail.personal.mail @@}}" ]
url = "https://{{@@ nextcloud.host @@}}/remote.php/dav/addressbooks/users/{{@@ nextcloud.user @@}}/"
username = "{{@@ nextcloud.user @@}}"
password.fetch = [ "command", "_pass_get", "{{@@ nextcloud.pass @@}}" ]
# CALDAV
[pair calendar]
@ -73,8 +73,8 @@ fileext = ".ics"
[storage calendar_remote]
type = "caldav"
url = "https://cloud.{{@@ mail.personal.mail @@}}/remote.php/dav/calendars/{{@@ mail.personal.user @@}}/"
username = "{{@@ mail.personal.user @@}}@{{@@ mail.personal.mail @@}}"
password.fetch = [ "command", "_pass_get", "{{@@ mail.personal.mail @@}}" ]
url = "https://{{@@ nextcloud.host @@}}/remote.php/dav/calendars/{{@@ nextcloud.user @@}}/"
username = "{{@@ nextcloud.user @@}}"
password.fetch = [ "command", "_pass_get", "{{@@ nextcloud.pass @@}}" ]
# vim: ft=ini

View File

@ -8,7 +8,7 @@
[user]
name = {{@@ username @@}}
email = {{@@ mail.personal.user @@}}@{{@@ mail.personal.mail @@}}
email = {{@@ mail.personal.user @@}}
[init]
defaultBranch = main

View File

@ -7,7 +7,7 @@
[user]
name = {{@@ mail.work.user.split("@")[0] | capitalize @@}}
email = {{@@ mail.work.user.split("@")[0] @@}}@{{@@ mail.work.mail @@}}
name = {{@@ mail.work.from | capitalize @@}}
email = {{@@ mail.work.user.split("@")[0] @@}}
# vim: ft=ini

View File

@ -1,9 +1,9 @@
{%@@ for name, info in mail.items() | reverse @@%}
IMAPStore {{@@ name @@}}-remote
Host {{@@ info.mail @@}}
Host {{@@ info.imap @@}}
Port 993
User {{@@ info.user.split("@")[0] @@}}@{{@@ info.mail @@}}
User {{@@ info.user @@}}
PassCmd "_pass_get {{@@ info.pass @@}}"
SSLType IMAPS
CertificateFile /etc/ssl/certs/ca-certificates.crt

20
dotfiles/neomutt/msmtprc Normal file
View File

@ -0,0 +1,20 @@
# Set default values for all following accounts.
defaults
auth on
tls on
tls_trust_file /etc/ssl/certs/ca-certificates.crt
logfile ~/.msmtp.log
{%@@ for name, info in mail.items() @@%}
account {{@@ name @@}}
host {{@@ info.smtp @@}}
port 587
from "{{@@ info.from @@}} <{{@@ info.user @@}}>"
user {{@@ info.user @@}}
passwordeval "_pass_get {{@@ info.pass @@}}"
{%@@ endfor @@%}
# Set a default account
account default : {{@@ (mail.keys() | list) [0] @@}}

View File

@ -15,21 +15,17 @@ set header_cache = ~/.cache/mutt/
set my_mailroot = ~/.local/share/mail
set use_from = yes
set ssl_force_tls = yes
# set ssl_force_tls = yes
{%@@ for name, info in mail.items() | reverse @@%}
set my_source_command = \
"_mutt_get-mail '{{@@ name @@}}' '{{@@ info.user.split("@")[0] @@}}' '{{@@ info.user @@}}' '{{@@ info.mail @@}}' |"
folder-hook "$my_mailroot/{{@@ name @@}}/" \
source "\"$my_source_command\""
source "$my_source_command"
set my_source_command = "_mutt_get-mail '{{@@ name @@}}' |"
folder-hook "$my_mailroot/{{@@ name @@}}/" source "\"$my_source_command\""
source "$my_source_command"
{%@@ endfor @@%}
{%@@ for name, info in mail.items() @@%}
set my_source_command = \
"_mutt_get-mail '{{@@ name @@}}' '{{@@ info.user.split("@")[0] @@}}' '{{@@ info.user @@}}' '{{@@ info.mail @@}}' '{{@@ info.pass @@}}' |"
macro index,pager <f{{@@ loop.index @@}}> "<sync-mailbox><enter-command>source \"$my_source_command\"<enter><change-folder>!<enter>"
set my_source_command = "_mutt_get-mail '{{@@ name @@}}' |"
macro index,pager <f{{@@ loop.index @@}}> "<sync-mailbox><enter-command>source \"$my_source_command\"<enter><change-folder>!<enter>"
{%@@ endfor @@%}
# }}}
@ -40,7 +36,7 @@ set sort = reverse-last-date
set sort_aux = last-date
set mail_check_stats = yes
set mail_check_stats_interval = 60
set mail_check_stats_interval = 10
set mark_old = no # Unread mail stay unread until read
set mailcap_path = ~/.config/neomutt/mailcap

View File

@ -1,6 +1,8 @@
[{{@@ mail.personal.mail.strip("mail.").split(".")[0] @@}}]
{%@@ set name = mail.personal.user.split("@")[1] @@%}
[{{@@ name @@}}]
type = webdav
vendor = nextcloud
user = {{@@ username @@}}
pass = {{@@ rclone_obscure(mail.personal.mail) @@}}
url = https://cloud.{{@@ mail.personal.mail @@}}/remote.php/webdav/
pass = {{@@ rclone_obscure(mail.personal.pass) @@}}
url = https://cloud.{{@@ name @@}}/remote.php/webdav/

View File

@ -1,16 +1,35 @@
#!/bin/sh
my_path="$1"
my_name="$2"
my_user="$3"
my_host="$4"
my_pass="$5"
if test "$#" -ne "1"; then
echo "Incorrect number of arguments, expected 1, got $#" >&2
fi
case "$1" in
{%@@ for name, info in mail.items() @@%}
{{@@ name @@}})
my_path="{{@@ name @@}}"
my_name="{{@@ info.from @@}}"
my_user="{{@@ info.user @@}}"
# my_host="{{@@ info.imap @@}}"
my_pass=`_pass_get "{{@@ info.pass @@}}"`
;;
{%@@ endfor @@%}
*)
echo "No valid account named $1" >&2
exit 1
;;
esac
cat <<EOF
set realname = "$my_name"
set from = "${my_name}@${my_host}"
set smtp_url = 'smtps://${my_user}@${my_host}'
set smtp_pass = '$my_pass'
set real_name = "$my_name"
set from = "$my_name <$my_user>"
set sendmail="/usr/bin/msmtp -a $my_path -- "
# set smtp_url = 'smtps://$my_user'
# set smtp_pass = '$my_pass'
# set Mailboxes
set folder = ~/.local/share/mail/${my_path}/
@ -28,3 +47,4 @@ mailboxes \
"=Trash" \
EOF

View File

@ -1,8 +1,7 @@
#!/bin/sh
gpg --list-secret-keys --with-keygrip \
"{{@@ username @@}}@{{@@ mail.personal.mail @@}}" |
gpg --list-secret-keys --with-keygrip |
awk '
/^ssb/ {
ssb=1

View File

@ -30,7 +30,7 @@ getnew() {
OLD=$(getnew)
if test "$1" = "update" && ! pidof mbsync; then
if ! ping -c3 {{@@ mail.personal.mail @@}} > /dev/null
if ! ping -c3 {{@@ mail.personal.imap @@}} > /dev/null
then
exit 0
fi

View File

@ -18,11 +18,13 @@ cargo-edit-0.8.0_1
chromium-97.0.4692.99_1
clyrics-0.13_1
cmatrix-2.0_1
cool-retro-term-1.1.1_1
cronie-1.5.7_1
cryptsetup-2.4.3_1
curl-7.81.0_2
dconf-0.40.0_1
diffr-0.1.4_1
direnv-2.30.3_1
docker-20.10.10_1
docker-compose-1.29.2_2
dust-0.7.5_1
@ -37,7 +39,6 @@ fd-8.3.2_1
firefox-96.0.2_1
fish-shell-3.3.1_1
flatpak-1.12.4_1
font-awesome-4.7.0_3
font-hack-ttf-3.003_2
fuse-sshfs-3.7.2_1
fzf-0.29.0_1
@ -105,6 +106,7 @@ mpDris2-0.9.1_1
mpc-0.33_1
mpd-0.23.5_2
mpv-0.34.1_1
msmtp-1.8.18_1
mtr-0.95_1
nano-6.0_1
ncmpcpp-0.9.2_4
@ -145,7 +147,7 @@ pulseaudio-15.0_3
pulsemixer-1.5.1_2
python3-ipython-7.31.0_1
python3-neovim-0.4.3_2
python3-pip-21.3.1_1
python3-pip-22.0.2_1
python3-wheel-0.37.0_2
qemu-6.1.0_3
qt5-5.15.3+20211001_2
@ -169,10 +171,11 @@ socklog-void-20200115_2
source-sans-pro-3.028_1
speedtest-cli-2.1.3_2
starship-1.2.1_1
swappy-1.3.1_1
sway-1.6.1_1
swayidle-1.7.1_1
swaylock-1.5_1
syncthing-1.18.6_1
syncthing-1.19.0_1
tealdeer-1.5.0_1
telegram-desktop-3.4.8_1
tesseract-ocr-eng-4.1.1_6