From dcb8e7ea8810631066a83b5d3ef2aa1ce613ceb8 Mon Sep 17 00:00:00 2001 From: Jeff LANCE Date: Mon, 4 Mar 2024 20:02:02 +0100 Subject: [PATCH] Up. --- home/.chezmoi.toml.tmpl | 17 ++++++---- home/dot_mbsyncrc.tmpl | 72 ++++++++++++++++++++--------------------- home/dot_msmtprc.tmpl | 58 +++++++-------------------------- 3 files changed, 59 insertions(+), 88 deletions(-) diff --git a/home/.chezmoi.toml.tmpl b/home/.chezmoi.toml.tmpl index 4614e23..d6b91f6 100644 --- a/home/.chezmoi.toml.tmpl +++ b/home/.chezmoi.toml.tmpl @@ -1,13 +1,18 @@ [data] email = {{ promptString "Git main email address " "" | quote }} -{{- with promptInt "How many mbsync accounts would you generate " 0 -}}{{- $count := . | int }} +{{- with promptInt "How many mail accounts would you like to configure " 0 -}}{{- $count := . | int }} {{- if gt $count 0 -}} {{- range $i, $e := until $count }} -[[data.mbsync]] -name = {{ promptString "MbSync account name " | quote }} -mail = {{ promptString "MbSync account mail " | quote }} -user = {{ promptString "MbSync account user " | quote }} -host = {{ promptString "MbSync account host " | quote }} +[[data.mail]] +comment = {{ promptString "Mail description " | quote }} +account = {{ promptString "Mail account name " | quote }} +address = {{ promptString "Mail address " | quote }} +usrname = {{ promptString "Mail username " | quote }} +imapsrv = {{ promptString "Mail imap host " | quote }} +smtpsrv = {{ promptString "Mail smtp host " | quote }} +smtport = {{ promptInt "Mail smtp port " 465 }} +smtpaut = {{ promptChoice "Mail smtp auth " (list "on" "plain") "on" }} +autofro = {{ promptChoice "Auto from " (list "on" "off") "off" }} {{- end }} {{- end }} {{- end }} diff --git a/home/dot_mbsyncrc.tmpl b/home/dot_mbsyncrc.tmpl index a72ce98..c579a0f 100644 --- a/home/dot_mbsyncrc.tmpl +++ b/home/dot_mbsyncrc.tmpl @@ -25,15 +25,15 @@ BufferLimit 100M # # ########################## -{{ range $value := .mbsync }} -# {{ $value.name }} +{{ range $value := .mail }} +# {{ $value.comment }} #------------------------- -IMAPAccount {{ $value.name }} +IMAPAccount {{ $value.account }} # Address to connect to -Host {{ $value.host }} -User {{ $value.user }} -PassCmd "pass {{ $value.host }}/{{ $value.user }}" +Host {{ $value.imapsrv }} +User {{ $value.usrname }} +PassCmd "pass {{ $value.host }}/{{ $value.usrname }}" # Use SSL # SSLType IMAPS SSLType None @@ -43,61 +43,61 @@ SSLType None CertificateFile /etc/ssl/certs/ca-certificates.crt -IMAPStore {{ $value.name }}-remote -Account {{ $value.name }} +IMAPStore {{ $value.account }}-remote +Account {{ $value.account }} -MaildirStore {{ $value.name }}-local +MaildirStore {{ $value.account }}-local SubFolders Verbatim # The trailing "/" is important -Path ~/Mail/{{ $value.name }}/ -Inbox ~/Mail/{{ $value.name }}/inbox +Path ~/Mail/{{ $value.account }}/ +Inbox ~/Mail/{{ $value.account }}/inbox -Channel {{ $value.name }}-inbox -Far :{{ $value.name }}-remote: -Near :{{ $value.name }}-local:inbox +Channel {{ $value.account }}-inbox +Far :{{ $value.account }}-remote: +Near :{{ $value.account }}-local:inbox Sync PullNew PullDelete Push SyncState * # Remove Both Expunge Both -Channel {{ $value.name }}-sent -Far :{{ $value.name }}-remote:"Sent Items" -Near :{{ $value.name }}-local:sent +Channel {{ $value.account }}-sent +Far :{{ $value.account }}-remote:"Sent Items" +Near :{{ $value.account }}-local:sent Sync PullNew PullDelete Push SyncState * Expunge Both -Channel {{ $value.name }}-trash -Far :{{ $value.name }}-remote:"Deleted Items" -Near :{{ $value.name }}-local:trash +Channel {{ $value.account }}-trash +Far :{{ $value.account }}-remote:"Deleted Items" +Near :{{ $value.account }}-local:trash Sync PullNew PullDelete Push SyncState * Expunge Both -Channel {{ $value.name }}-drafts -Far :{{ $value.name }}-remote:"Drafts" -Near :{{ $value.name }}-local:drafts +Channel {{ $value.account }}-drafts +Far :{{ $value.account }}-remote:"Drafts" +Near :{{ $value.account }}-local:drafts Sync PullNew PullDelete Push SyncState * Expunge Both -Channel {{ $value.name }}-junk -Far :{{ $value.name }}-remote:"Junk Email" -Near :{{ $value.name }}-local:junk +Channel {{ $value.account }}-junk +Far :{{ $value.account }}-remote:"Junk Email" +Near :{{ $value.account }}-local:junk Sync PullNew PullDelete Push SyncState * Expunge Both -Channel {{ $value.name }}-archive -Far :{{ $value.name }}-remote:"Archive" -Near :{{ $value.name }}-local:archive +Channel {{ $value.account }}-archive +Far :{{ $value.account }}-remote:"Archive" +Near :{{ $value.account }}-local:archive Pattern * Create Near MaxMessages 1500 @@ -106,12 +106,12 @@ SyncState * Expunge Both -Group {{ $value.name }} -Channel {{ $value.name }}-inbox -Channel {{ $value.name }}-sent -Channel {{ $value.name }}-trash -Channel {{ $value.name }}-drafts -Channel {{ $value.name }}-junk -Channel {{ $value.name }}-archive +Group {{ $value.account }} +Channel {{ $value.account }}-inbox +Channel {{ $value.account }}-sent +Channel {{ $value.account }}-trash +Channel {{ $value.account }}-drafts +Channel {{ $value.account }}-junk +Channel {{ $value.account }}-archive {{ end }} diff --git a/home/dot_msmtprc.tmpl b/home/dot_msmtprc.tmpl index fb3e05e..fdecb7d 100644 --- a/home/dot_msmtprc.tmpl +++ b/home/dot_msmtprc.tmpl @@ -5,52 +5,18 @@ tls_trust_file /etc/ssl/certs/ca-certificates.crt syslog on # logfile /var/log/msmtp.log -# MaLa -account jeff.lance@mala.fr -host ssl0.ovh.net -port 465 -auth on +{{ range $value := .mail }} +# {{ $value.comment }} +account {{ $value.account }} +host {{ $value.smtpsrv }} +port {{ $value.smtport }} +auth {{ $value.smtpaut }} tls on tls_starttls off -user jeff.lance@mala.fr -passwordeval "echo $(pass ssl0.ovh.net/jeff.lance@mala.fr)" -auto_from off -from jeff.lance@mala.fr +user {{ $value.usrname }} +passwordeval "echo $(pass {{ $value.smtpsrv }}/{{ $value.usrname }})" +auto_from {{ $value.autofro }} +from {{ $value.address }} +# +{{ end }} -account games@mala.fr -host ssl0.ovh.net -port 465 -auth on -tls on -tls_starttls off -user games@mala.fr -passwordeval "echo $(pass ssl0.ovh.net/games@mala.fr)" -auto_from off -from games@mala.fr - -# GMail -account mathslance@gmail.com -host imap.gmail.com -port 465 -auth on -tls on -tls_starttls off -user mathslance@gmail.com -passwordeval "echo $(pass google.com/mathslance@gmail.com)" -auto_from off -from mathslance@gmail.com - -# Ac-creteil -account jean-francois.lance@ac-creteil.fr -host smtp-ext.ac-creteil.fr -port 465 -auth plain -tls on -tls_starttls off -user jlance -passwordeval "echo $(pass ac-creteil.fr/jlance)" -auto_from off -from jean-francois.lance@ac-creteil.fr - -# Set a default account -account default : jeff.lance@mala.fr