From 37c70457c527bb467b6751924f06a249bddb0e00 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C3=93scar=20N=C3=A1jera?= Date: Sat, 5 Dec 2020 14:05:40 +0100 Subject: Setting up mail config files for personal and employer setups --- install.scm | 45 ++++++++++++++- mail/dot-mbsyncrc | 140 -------------------------------------------- mail/dot-mbsyncrc.personal | 141 +++++++++++++++++++++++++++++++++++++++++++++ mail/dot-mbsyncrc.work | 28 +++++++++ 4 files changed, 213 insertions(+), 141 deletions(-) delete mode 100644 mail/dot-mbsyncrc create mode 100644 mail/dot-mbsyncrc.personal create mode 100644 mail/dot-mbsyncrc.work diff --git a/install.scm b/install.scm index 46ee7a2..f56a591 100755 --- a/install.scm +++ b/install.scm @@ -156,6 +156,49 @@ (log-msg 'INFO " Symlink Tribe29 config") (config-links "git/tribe29" "~/git/.gitconfig" #f)) +(define (format-config-entry item) + (format #t "[~a]~%" (car item)) + (format #t "~:{~a=~@{~a~^;~}~%~}~%" (cdr item))) + +(define (mail-config) + (log-msg 'INFO "Configuring mail") + (log-msg 'INFO " Symlink mbsync") + (config-links (if (string=? (gethostname) "klappbier") + "mail/dot-mbsyncrc.work" + "mail/dot-mbsyncrc.personal") + "~/.mbsyncrc" #f) + (let* ((notmuch-config-file (expand-file "~/.notmuch-config")) + (emails + (list + "hi@oscarnajera.com" + "hello@oscarnajera.com" + "najera.oscar@gmail.com" + "oscar.najera-ocampo@u-psud.fr" + ;; Employer related + "oscar.najera@tribe29.com" + "on@mathias-kettner.de")) + (user-mail + (if (string=? (gethostname) "klappbier") + "oscar.najera@tribe29.com" + "hi@oscarnajera.com")) + ;; setting up notmuch config + (config + `((database (path ".mail")) + (user (name "Oscar Najera") + (primary_email ,user-mail) + ,(cons 'other_email (delete user-mail emails))) + (new (tags new) + (ignore .uidvalidity .mbsyncstate .directory)) + (search (exclude_tags deleted spam)) + (maildir (synchronize_flags true)) + (crypto (gpg_path gpg))))) + (clean-file notmuch-config-file #f) + (with-output-to-file notmuch-config-file + (lambda () + (display "# -*- mode: conf-unix -*-\n# managed by dotfiles install\n") + (for-each format-config-entry config))) + (chmod notmuch-config-file #o400))) + (define (main args) (setup-logging) (log-msg 'INFO "Symlink PIM") @@ -167,6 +210,6 @@ (config-links "gnupu/gpg-agent.conf" "~/.gnupg/gpg-agent" #f) (symlink-tree "bin" "~/.local/bin") (symlink-tree "config" "~/.config") - (symlink-tree "mail" "~/") + (mail-config) (shutdown-logging)) diff --git a/mail/dot-mbsyncrc b/mail/dot-mbsyncrc deleted file mode 100644 index 3e3e7d6..0000000 --- a/mail/dot-mbsyncrc +++ /dev/null @@ -1,140 +0,0 @@ -############################################################################### -# GMAIL - -IMAPAccount gmail -# Address to connect to -Host imap.gmail.com -User najera.oscar@gmail.com -PassCmd "pass show google/googlemail.com/najera.oscar" -AuthMechs LOGIN -# Use SSL -SSLType IMAPS -# The following line should work. If get certificate errors, uncomment the two following lines and read the "Troubleshooting" section. -CertificateFile /etc/ssl/certs/ca-certificates.crt -#CertificateFile ~/.cert/imap.gmail.com.pem -#CertificateFile ~/.cert/Equifax_Secure_CA.pem - -IMAPStore gmail-remote -Account gmail - -MaildirStore gmail-local -# The trailing "/" is important -Path ~/.mail/gmail/ -Inbox ~/.mail/gmail/Inbox -SubFolders Legacy - -Channel gmail -Master :gmail-remote: -Slave :gmail-local: -# Exclude everything under the internal [Gmail] folder, except the interesting folders -Patterns * ![Gmail]* "[Gmail]/Sent Mail" -# Or include everything -#Patterns * -# Automatically create missing mailboxes, both locally and on the server -Create Both -# Save the synchronization state files in the relevant directory -SyncState * -Expunge Both - -############################################################################### -# Personal -IMAPAccount hi_pers -Host git.oscarnajera.com -User hi@oscarnajera.com -PassCmd "pass show Correos/mail.oscarnajera.com" -AuthMechs LOGIN -SSLType IMAPS - -IMAPStore hi_pers-remote -Account hi_pers - -MaildirStore hi_pers-local -Path ~/.mail/hi_pers/ -Inbox ~/.mail/hi_pers/Inbox -SubFolders Verbatim - -Channel hi_pers -Master :hi_pers-remote: -Slave :hi_pers-local: -Patterns * -Create Both -SyncState * -Expunge Both - -############################################################################### -# AMZbooks -IMAPAccount kindle -Host git.oscarnajera.com -User kindle@oscarnajera.com -PassCmd "pass show Correos/kindle@oscarnajera.com" -AuthMechs LOGIN -SSLType IMAPS - -IMAPStore kindle-remote -Account kindle - -MaildirStore kindle-local -Path ~/.mail/kindle/ -Inbox ~/.mail/kindle/Inbox -SubFolders Verbatim - -Channel kindle -Master :kindle-remote: -Slave :kindle-local: -Patterns * -Create Both -SyncState * -Expunge Both - -############################################################################### -# Startup -IMAPAccount delightfuldying -Host git.oscarnajera.com -User oscar.najera@delightfuldying.com -PassCmd "pass show WebSites/delightfuldying.com/mailbox/julie" -AuthMechs LOGIN -SSLType IMAPS - -IMAPStore dd-remote -Account delightfuldying - -MaildirStore dd-local -Path ~/.mail/dd/ -Inbox ~/.mail/dd/Inbox -SubFolders Verbatim - -Channel delightfuldying -Master :dd-remote: -Slave :dd-local: -Patterns * -Create Both -SyncState * -Expunge Both - -############################################################################### -# Startup -IMAPAccount fallforward -Host git.oscarnajera.com -User sarah@fallforward.space -PassCmd "pass show WebSites/fallforward.space/mailbox/sarah" -AuthMechs LOGIN -SSLType IMAPS - -IMAPStore ff-remote -Account fallforward - -MaildirStore ff-local -Path ~/.mail/ff/ -Inbox ~/.mail/ff/Inbox -SubFolders Verbatim - -Channel fallforward -Master :ff-remote: -Slave :ff-local: -Patterns * -Create Both -SyncState * -Expunge Both -# Local Variables: -# mode: conf-unix -# End: diff --git a/mail/dot-mbsyncrc.personal b/mail/dot-mbsyncrc.personal new file mode 100644 index 0000000..6c3be07 --- /dev/null +++ b/mail/dot-mbsyncrc.personal @@ -0,0 +1,141 @@ +############################################################################### +# GMAIL + +IMAPAccount gmail +# Address to connect to +Host imap.gmail.com +User najera.oscar@gmail.com +PassCmd "pass show google/googlemail.com/najera.oscar" +AuthMechs LOGIN +# Use SSL +SSLType IMAPS +# The following line should work. If get certificate errors, uncomment the two following lines and read the "Troubleshooting" section. +CertificateFile /etc/ssl/certs/ca-certificates.crt +#CertificateFile ~/.cert/imap.gmail.com.pem +#CertificateFile ~/.cert/Equifax_Secure_CA.pem + +IMAPStore gmail-remote +Account gmail + +MaildirStore gmail-local +# The trailing "/" is important +Path ~/.mail/gmail/ +Inbox ~/.mail/gmail/Inbox +SubFolders Legacy + +Channel gmail +Master :gmail-remote: +Slave :gmail-local: +# Exclude everything under the internal [Gmail] folder, except the interesting folders +Patterns * ![Gmail]* "[Gmail]/Sent Mail" +# Or include everything +#Patterns * +# Automatically create missing mailboxes, both locally and on the server +Create Both +# Save the synchronization state files in the relevant directory +SyncState * +Expunge Both + +############################################################################### +# Personal +IMAPAccount hi_pers +Host git.oscarnajera.com +User hi@oscarnajera.com +PassCmd "pass show Correos/mail.oscarnajera.com" +AuthMechs LOGIN +SSLType IMAPS + +IMAPStore hi_pers-remote +Account hi_pers + +MaildirStore hi_pers-local +Path ~/.mail/hi_pers/ +Inbox ~/.mail/hi_pers/Inbox +SubFolders Verbatim + +Channel hi_pers +Master :hi_pers-remote: +Slave :hi_pers-local: +Patterns * +Create Both +SyncState * +Expunge Both + +############################################################################### +# AMZbooks +IMAPAccount kindle +Host git.oscarnajera.com +User kindle@oscarnajera.com +PassCmd "pass show Correos/kindle@oscarnajera.com" +AuthMechs LOGIN +SSLType IMAPS + +IMAPStore kindle-remote +Account kindle + +MaildirStore kindle-local +Path ~/.mail/kindle/ +Inbox ~/.mail/kindle/Inbox +SubFolders Verbatim + +Channel kindle +Master :kindle-remote: +Slave :kindle-local: +Patterns * +Create Both +SyncState * +Expunge Both + +############################################################################### +# Startup +IMAPAccount delightfuldying +Host git.oscarnajera.com +User oscar.najera@delightfuldying.com +PassCmd "pass show WebSites/delightfuldying.com/mailbox/julie" +AuthMechs LOGIN +SSLType IMAPS + +IMAPStore dd-remote +Account delightfuldying + +MaildirStore dd-local +Path ~/.mail/dd/ +Inbox ~/.mail/dd/Inbox +SubFolders Verbatim + +Channel delightfuldying +Master :dd-remote: +Slave :dd-local: +Patterns * +Create Both +SyncState * +Expunge Both + +############################################################################### +# Startup +IMAPAccount fallforward +Host git.oscarnajera.com +User sarah@fallforward.space +PassCmd "pass show WebSites/fallforward.space/mailbox/sarah" +AuthMechs LOGIN +SSLType IMAPS + +IMAPStore ff-remote +Account fallforward + +MaildirStore ff-local +Path ~/.mail/ff/ +Inbox ~/.mail/ff/Inbox +SubFolders Verbatim + +Channel fallforward +Master :ff-remote: +Slave :ff-local: +Patterns * +Create Both +SyncState * +Expunge Both + +# Local Variables: +# mode: conf-unix +# End: diff --git a/mail/dot-mbsyncrc.work b/mail/dot-mbsyncrc.work new file mode 100644 index 0000000..3dc9bf2 --- /dev/null +++ b/mail/dot-mbsyncrc.work @@ -0,0 +1,28 @@ +############################################################################### +# Work +IMAPAccount work +Host mx.tribe29.com +User on +PassCmd "pass show Correos/mx.tribe29.com" +AuthMechs LOGIN +SSLType IMAPS + +IMAPStore work-remote +Account work + +MaildirStore work-local +Path ~/.mail/work/ +Inbox ~/.mail/work/Inbox +SubFolders Verbatim + +Channel work +Master :work-remote: +Slave :work-local: +Patterns * +Create Both +SyncState * +Expunge Both + +# Local Variables: +# mode: conf-unix +# End: -- cgit v1.2.3