Feat: neomutt config with external imap and smtp

This commit is contained in:
Bertrand Benjamin 2022-11-09 06:58:25 +01:00
parent 86ee7c8bce
commit 99a78b8e7d
12 changed files with 461 additions and 57 deletions

View File

@ -0,0 +1,50 @@
# Example for a user configuration file ~/.msmtprc
# With modern mail services that publish autoconfiguration information,
# you can simply run 'msmtp --configure yourmail@example.com' to get
# a basic working configuration.
# This example focusses on TLS and authentication. Features not used here
# include logging, timeouts, SOCKS proxies, TLS parameters, Delivery Status
# Notification (DSN) settings, and more.
# Set default values: use the mail submission port 587, and always use TLS.
# On this port, TLS is activated via STARTTLS.
defaults
port 587
tls on
tls_starttls on
auth on
tls_trust_file /etc/ssl/certs/ca-certificates.crt
logfile ~/.msmtp.log
account bb_opytex
user Takanuva
passwordeval "pass mail/mailfence/Takanuva | head -n1"
auth on
host smtp.mailfence.com
port 465
# Envelope-from address
from benjamin.bertrand@opytex.org
tls_starttls off
account jb_opytex
user margot_benjamin
passwordeval "pass mail/jost_bertrand@opytex.org/margot_benjamin | head -n1"
auth on
host smtp.mailfence.com
port 465
# Envelope-from address
from jost_bertrand@opytex.org
tls_starttls off
account ac-lyon
user bbertrand
passwordeval "pass Prof/pronote/bbertrand | head -n1"
auth on
host smtps.ac-lyon.fr
# Envelope-from address
from benjamin.bertrand@ac-lyon.fr
# Set a default account
account default : bb_opytex

View File

@ -1,26 +1,43 @@
# vim: filetype=muttrc
unmailboxes *
set my_pass = "`pass Prof/pronote/bbertrand`"
set folder = "imaps://mail.ac-lyon.fr"
set imap_user = bbertrand
set imap_pass = $my_pass
set ssl_force_tls = yes
set smtp_url = smtps://$imap_user@smtps.ac-lyon.fr:587
set smtp_pass = $my_pass
set ssl_starttls = yes
set smtp_authenticators = "login"
set from = "benjamin.bertrand@ac-lyon.fr"
set spoolfile = +INBOX
mailboxes = +INBOX
set imap_check_subscribed
set sendmail = "/usr/bin/msmtp -a ac-lyon"
set folder = "~/.mail/ac_lyon"
set spoolfile = "+INBOX"
set postponed = "+Drafts"
set record = "+Sent"
set trash = "+Trash"
set postponed = "+Drafts"
## Hook -- IMPORTANT!
account-hook $folder "set imap_pass=`pass Prof/pronote/bbertrand`"
set mbox_type = Maildir
set ssl_starttls = yes
set ssl_force_tls = yes
color status blue default
#mailboxes =INBOX =Sent =Drafts =Junk
# set my_pass = "`pass Prof/pronote/bbertrand`"
# set folder = "imaps://mail.ac-lyon.fr"
# set imap_user = bbertrand
# set imap_pass = $my_pass
#
# set ssl_force_tls = yes
# set smtp_url = smtps://$imap_user@smtps.ac-lyon.fr:587
# set smtp_pass = $my_pass
# set ssl_starttls = yes
# set smtp_authenticators = "login"
#
# set spoolfile = +INBOX
# mailboxes = +INBOX
# set imap_check_subscribed
#
# set record = "+Sent"
# set trash = "+Trash"
# set postponed = "+Drafts"
#
# ## Hook -- IMPORTANT!
# account-hook $folder "set imap_pass=`pass Prof/pronote/bbertrand`"

View File

@ -1,26 +1,43 @@
# vim: filetype=muttrc
unmailboxes *
set my_pass = "`pass mail/mailfence/Takanuva`"
set folder = "imaps://imap.mailfence.com/"
set imap_user = Takanuva
set imap_pass = $my_pass
set ssl_force_tls = yes
set smtp_url = smtps://$imap_user@smtp.mailfence.com:465
set smtp_pass = $my_pass
set ssl_starttls = yes
set smtp_authenticators = "login"
set from = "benjamin.bertrand@opytex.org"
set spoolfile = +INBOX
set imap_check_subscribed
set sendmail = "/usr/bin/msmtp -a bb_opytex"
set folder = "~/.mail/bb_opytex"
set record = "+Sent"
set trash = "+Trash"
set spoolfile = "+INBOX"
set postponed = "+Drafts"
set record = "+Sent"
set trash = "+Junk"
## Hook -- IMPORTANT!
account-hook $folder "set imap_pass=`pass mail/mailfence/Takanuva`"
set mbox_type = Maildir
set ssl_starttls = yes
set ssl_force_tls = yes
color status cyan default
# mailboxes =INBOX =Sent =Drafts =Junk
# set my_pass = "`pass mail/mailfence/Takanuva`"
# set folder = "imaps://imap.mailfence.com/"
# set imap_user = Takanuva
# set imap_pass = $my_pass
#
# set ssl_force_tls = yes
# set smtp_url = smtps://$imap_user@smtp.mailfence.com:465
# set smtp_pass = $my_pass
# set ssl_starttls = yes
# set smtp_authenticators = "login"
#
#
# set spoolfile = +INBOX
#
# set record = "+Sent"
# set trash = "+Trash"
# set postponed = "+Drafts"
#
#
# ## Hook -- IMPORTANT!
# account-hook $folder "set imap_pass=`pass mail/mailfence/Takanuva`"

View File

@ -0,0 +1,44 @@
# vim: filetype=muttrc
unmailboxes *
set imap_list_subscribed
set imap_check_subscribed
set from = "jost_bertrand@opytex.org"
set sendmail = "/usr/bin/msmtp -a jb_opytex"
set folder = "~/.mail/jb_opytex"
set spoolfile = "+INBOX"
set postponed = "+Drafts"
set record = "+Sent"
set trash = "+Junk"
set mbox_type = Maildir
set ssl_starttls = yes
set ssl_force_tls = yes
color status red default
# set my_pass = "`pass mail/mailfence/Takanuva`"
# set folder = "imaps://imap.mailfence.com/"
# set imap_user = Takanuva
# set imap_pass = $my_pass
#
# set ssl_force_tls = yes
# set smtp_url = smtps://$imap_user@smtp.mailfence.com:465
# set smtp_pass = $my_pass
# set ssl_starttls = yes
# set smtp_authenticators = "login"
#
#
# set spoolfile = +INBOX
# set imap_check_subscribed
#
# set record = "+Sent"
# set trash = "+Trash"
# set postponed = "+Drafts"
#
#
# ## Hook -- IMPORTANT!
# account-hook $folder "set imap_pass=`pass mail/mailfence/Takanuva`"

View File

@ -1,23 +1,100 @@
# -*-muttrc-*-
# Palette for use with the Linux console. Black background.
# Screenshot http://trovao.droplinegnome.org/stuff/mutt-zenburnt.png
#
# This is a zenburn-based neomutt color scheme that is not (even by far)
# complete. There's no copyright involved. Do whatever you want with it.
# Just be aware that I won't be held responsible if the current color-scheme
# explodes your mail client. ;)
#
# Do notice that this color scheme requires a terminal emulator that supports
# 256 color. Any modern X terminal emulator should have support for that and
# you can enable it by calling neomutt as "TERM=xterm-256color neomutt" or, if you
# use screen, by adding "term screen-256color" to your .screenrc.
#
# This file is in the public domain.
#
color hdrdefault blue black
color quoted blue black
color signature blue black
color attachment red black
color prompt brightmagenta black
color message brightred black
color error brightred black
color indicator black red
color status brightgreen blue
color tree white black
color normal white black
color markers red black
color search white black
color tilde brightmagenta black
color index blue black ~F
color index red black "~N|~O"
# general-doesn't-fit stuff
color normal color188 color237
color error color115 color236
color markers color142 color238
color tilde color108 color237
color status color144 color234
# color body brightwhite black '\*+[^*]+\*+'
# color body brightwhite black '_+[^_]+_+'
# index stuff
color indicator color108 color236
color tree color109 color237
color index color188 color237 ~A
color index color188 color237 ~N
color index color188 color237 ~O
color index color174 color237 ~F
color index color174 color237 ~D
# Message Index ----------------------------------------------------------------
## Weak
color index color08 color00 "~R" # read messages
color index color08 color00 "~d >45d" # older than 45 days
color index color08 color00 "~v~(!~N)" # collapsed thread with no unread
color index color08 color00 "~Q" # messages that have been replied to
## Strong
color index color21 color00 "(~U|~N|~O)" # unread, new, old messages
color index color21 color00 "~v~(~U|~N|~O)" # collapsed thread with unread
## Highlight
### Trusted
color index color06 color00 "~g" # PGP signed messages
color index color06 color00 "~G" # PGP encrypted messages
### Odd
color index color01 color00 "~E" # past Expires: header date
color index color01 color00 "~=" # duplicated
color index color01 color00 "~S" # marked by Supersedes: header
### Flagged
color index color05 color00 "~F" # flagged messages
color index color02 color00 "~v~(~F)" # collapsed thread with flagged inside
# Selection
color index color02 color18 "~T" # tagged messages
color index color01 color18 "~D" # deleted messages
#
# header stuff
color hdrdefault color223 color237
color header color223 color237 "^Subject"
# gpg stuff
color body color188 color237 "^gpg: Good signature.*"
color body color115 color236 "^gpg: BAD signature.*"
color body color174 color237 "^gpg: Can't check signature.*"
color body color174 color237 "^-----BEGIN PGP SIGNED MESSAGE-----"
color body color174 color237 "^-----BEGIN PGP SIGNATURE-----"
color body color174 color237 "^-----END PGP SIGNED MESSAGE-----"
color body color174 color237 "^-----END PGP SIGNATURE-----"
color body color174 color237 "^Version: GnuPG.*"
color body color174 color237 "^Comment: .*"
# url, email and web stuff
color body color174 color237 "(finger|ftp|http|https|news|telnet)://[^ >]*"
color body color174 color237 "<URL:[^ ]*>"
color body color174 color237 "www\\.[-.a-z0-9]+\\.[a-z][a-z][a-z]?([-_./~a-z0-9]+)?"
color body color174 color237 "mailto: *[^ ]+\(\\i?subject=[^ ]+\)?"
color body color174 color237 "[-a-z_0-9.%$]+@[-a-z_0-9.]+\\.[-a-z][-a-z]+"
# misc body stuff
color attachment color174 color237 #Add-ons to the message
color signature color223 color237
# quote levels
color quoted color108 color237
color quoted1 color116 color237
color quoted2 color247 color237
color quoted3 color108 color237
color quoted4 color116 color237
color quoted5 color247 color237
color quoted6 color108 color237
color quoted7 color116 color237
color quoted8 color247 color237
color quoted9 color108 color237

View File

@ -0,0 +1,121 @@
# -*-muttrc-*-
# gruvbox dark (contrast dark):
# bg0 = 234
# bg1 = 237
# bg2 = 239
# bg3 = 241
# bg4 = 243
#
# gray = 245
#
# fg0 = 229
# fg1 = 223
# fg2 = 250
# fg3 = 248
# fg4 = 246
#
# red = 167
# green = 142
# yellow = 214
# blue = 109
# purple = 175
# aqua = 108
# orange = 208
# See http://www.mutt.org/doc/manual/#color
color attachment color109 color234
color bold color229 color234
color error color167 color234
color hdrdefault color246 color234
color indicator color223 color237
color markers color243 color234
color normal color223 color234
color quoted color250 color234
color quoted1 color108 color234
color quoted2 color250 color234
color quoted3 color108 color234
color quoted4 color250 color234
color quoted5 color108 color234
color search color234 color208
color signature color108 color234
color status color234 color250
color tilde color243 color234
color tree color142 color234
color underline color223 color239
color sidebar_divider color250 color234
color sidebar_new color142 color234
color index color142 color234 ~N
color index color108 color234 ~O
color index color109 color234 ~P
color index color214 color234 ~F
color index color175 color234 ~Q
color index color167 color234 ~=
color index color234 color223 ~T
color index color234 color167 ~D
color header color214 color234 "^(To:|From:)"
color header color142 color234 "^Subject:"
color header color108 color234 "^X-Spam-Status:"
color header color108 color234 "^Received:"
# Regex magic for URLs and hostnames
#
# Attention: BSD's regex has RE_DUP_MAX set to 255.
#
# Examples:
# http://some-service.example.com
# example.com
# a.example.com
# some-service.example.com
# example.com/
# example.com/datenschutz
# file:///tmp/foo
#
# Non-examples:
# 1.1.1900
# 14.02.2022/24:00
# 23.59
# w.l.o.g
# team.its
color body color142 color234 "[a-z]{3,255}://[[:graph:]]*"
color body color142 color234 "([-[:alnum:]]+\\.)+([0-9]{1,3}|[-[:alpha:]]+)/[[:graph:]]*"
color body color142 color234 "([-[:alnum:]]+\\.){2,255}[-[:alpha:]]{2,10}"
# IPv4 and IPv6 stolen from https://stackoverflow.com/questions/53497/regular-expression-that-matches-valid-ipv6-addresses
color body color142 color234 "((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])"
color body color142 color234 "(([0-9a-fA-F]{1,4}:){7,7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:)|fe80:(:[0-9a-fA-F]{0,4}){0,4}%[0-9a-zA-Z]{1,}|::(ffff(:0{1,4}){0,1}:){0,1}((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\\\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])|([0-9a-fA-F]{1,4}:){1,4}:((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9]))"
# Mail addresses and mailto URLs
color body color208 color234 "[-a-z_0-9.%$]+@[-a-z_0-9.]+\\.[-a-z][-a-z]+"
color body color208 color234 "mailto:[-a-z_0-9.]+@[-a-z_0-9.]+"
# some simleys and stuff
color body color234 color214 "[;:]-*[)>(<lt;|]"
color body color229 color234 "\\*[- A-Za-z]+\\*"
color body color214 color234 "^-.*PGP.*-*"
color body color142 color234 "^gpg: Good signature from"
color body color167 color234 "^gpg: Can't.*$"
color body color214 color234 "^gpg: WARNING:.*$"
color body color167 color234 "^gpg: BAD signature from"
color body color167 color234 "^gpg: Note: This key has expired!"
color body color214 color234 "^gpg: There is no indication that the signature belongs to the owner."
color body color214 color234 "^gpg: can't handle these multiple signatures"
color body color214 color234 "^gpg: signature verification suppressed"
color body color214 color234 "^gpg: invalid node with packet of type"
color body color142 color234 "^Good signature from:"
color body color167 color234 "^.?BAD.? signature from:"
color body color142 color234 "^Verification successful"
color body color167 color234 "^Verification [^s][^[:space:]]*$"
color compose header color223 color234
color compose security_encrypt color175 color234
color compose security_sign color109 color234
color compose security_both color142 color234
color compose security_none color208 color234

View File

@ -0,0 +1 @@
mailboxes "+ac_lyon/Archives" "+ac_lyon/Archives.2019-2020" "+ac_lyon/Archives.2020-2021" "+ac_lyon/Archives.2021-2022" "+ac_lyon/Archives.2022-2023" "+ac_lyon/Archives/2019-2020" "+ac_lyon/Archives/2020-2021" "+ac_lyon/Archives/2021-2022" "+ac_lyon/Archives/2022-2023" "+ac_lyon/Brouillons" "+ac_lyon/Drafts" "+ac_lyon/Eleves" "+ac_lyon/Eleves.2nd1" "+ac_lyon/Eleves/2nd1" "+ac_lyon/Envoy&AOk-s" "+ac_lyon/INBOX" "+ac_lyon/Junk" "+ac_lyon/Sent" "+ac_lyon/TICE" "+ac_lyon/Trash" "+bb_opytex/Archive" "+bb_opytex/Drafts" "+bb_opytex/INBOX" "+bb_opytex/R&AOk-seautage" "+bb_opytex/Sent Items" "+bb_opytex/Spam?" "+bb_opytex/Trash" "+jb_opytex/2021" "+jb_opytex/2022" "+jb_opytex/Archive" "+jb_opytex/Drafts" "+jb_opytex/INBOX" "+jb_opytex/Sent Items" "+jb_opytex/Spam?" "+jb_opytex/Trash"

View File

@ -52,4 +52,5 @@ bind editor <Tab> complete-query
## Shortcuts
macro index,pager <f2> '<sync-mailbox><enter-command>source ~/.config/neomutt/accounts/ac-lyon<enter><change-folder>!<enter>'
macro index,pager <f3> '<sync-mailbox><enter-command>source ~/.config/neomutt/accounts/bb_opytex<enter><change-folder>!<enter>'
macro index,pager <f4> '<sync-mailbox><enter-command>source ~/.config/neomutt/accounts/jb_opytex<enter><change-folder>!<enter>'

View File

@ -1,11 +1,15 @@
# vim: filetype=muttrc
source ~/.config/neomutt/settings
source ~/.config/neomutt/colors
source ~/.config/neomutt/colors_gruvbox
source ~/.config/neomutt/mappings
#source ~/.config/neomutt/accounts/jb_opytex
folder-hook jb_opytex/* 'source ~/.config/neomutt/accounts/jb_opytex'
#source ~/.config/neomutt/accounts/bb_opytex
folder-hook bb_opytex/* 'source ~/.config/neomutt/accounts/bb_opytex'
source ~/.config/neomutt/accounts/ac-lyon
folder-hook $folder 'source ~/.config/neomutt/accounts/ac-lyon'
source ~/.config/neomutt/accounts/bb_opytex
folder-hook $folder 'source ~/.config/neomutt/accounts/bb_opytex'
folder-hook ac_lyon/* 'source ~/.config/neomutt/accounts/ac-lyon'
#source ~/.config/neomutt/mailboxes

View File

@ -0,0 +1,67 @@
[general]
accounts = bb_opytex, jb_opytex, ac_lyon
pythonfile = ~/.config/offlineimap/offlineimap.py
maxsyncaccounts = 1
[mbnames]
enabled = yes
filename = ~/.config/neomutt/mailboxes
header = "mailboxes "
peritem = "+%(accountname)s/%(foldername)s"
sep = " "
footer = "\n"
[Account bb_opytex]
localrepository = Local-bb_opytex
remoterepository = Remote-bb_opytex
autorefresh = 1
quick = 10
[Repository Local-bb_opytex]
type = Maildir
localfolders = ~/.mail/bb_opytex
sep = /
[Repository Remote-bb_opytex]
type = IMAP
remotehost = imap.mailfence.com
remoteuser = Takanuva
remotepasseval = get_pass("mail/mailfence/Takanuva")
sslcacertfile = /etc/ssl/certs/ca-certificates.crt
[Account jb_opytex]
localrepository = Local-jb_opytex
remoterepository = Remote-jb_opytex
autorefresh = 1
quick = 10
[Repository Local-jb_opytex]
type = Maildir
localfolders = ~/.mail/jb_opytex
sep = /
[Repository Remote-jb_opytex]
type = IMAP
remotehost = imap.mailfence.com
remoteuser = margot_benjamin
remotepasseval = get_pass("mail/jost_bertrand@opytex.org/margot_benjamin")
sslcacertfile = /etc/ssl/certs/ca-certificates.crt
[Account ac_lyon]
localrepository = Local-ac_lyon
remoterepository = Remote-ac_lyon
autorefresh = 1
quick = 10
[Repository Local-ac_lyon]
type = Maildir
localfolders = ~/.mail/ac_lyon
sep = /
[Repository Remote-ac_lyon]
type = IMAP
remotehost = mail.ac-lyon.fr
remoteuser = bbertrand
remotepasseval = get_pass("Prof/pronote/bbertrand")
sslcacertfile = /etc/ssl/certs/ca-certificates.crt

View File

@ -0,0 +1,5 @@
from subprocess import check_output
def get_pass(path):
return check_output("pass " + path, shell=True).splitlines()[0]