From 754bbf7a25a8dda49b5d08ef0d0443bbf5af0e36 Mon Sep 17 00:00:00 2001 From: Craig Jennings Date: Sun, 7 Apr 2024 13:41:34 -0500 Subject: new repository --- scripts/setup-email.sh | 51 ++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 51 insertions(+) create mode 100755 scripts/setup-email.sh (limited to 'scripts/setup-email.sh') diff --git a/scripts/setup-email.sh b/scripts/setup-email.sh new file mode 100755 index 00000000..1f0d5bad --- /dev/null +++ b/scripts/setup-email.sh @@ -0,0 +1,51 @@ +#!/usr/bin/env bash +# ------------------------------ Notes ------------------------------ +# Craig Jennings +# +# this mu4e mail setup script is particular to my own setup +# ===== this will not work for you ===== + +MBSYNC=/usr/bin/mbsync +MBSYNCRC=~/.mbsyncrc +MU4E_DIR=/usr/share/emacs/site-lisp/mu4e/ +MSMTP=/usr/bin/msmtp +MSMTPRC=~/.msmtprc +MU=/usr/bin/mu +GMAIL=~/.mail/gmail +CMAIL=~/.mail/cmail + +# ----------------------- Preliminary Checks ---------------------- +# is mbsync installed? +if ! [ -f $MBSYNC ]; then echo "mbsync not installed at $MBSYNC. Install package 'isync' to continue"; exit 1; fi +if ! [ -f $MU ]; then echo "mu not installed at $MU. Install package 'mu' to continue"; exit 1; fi +if ! [ -d $MU4E ]; then echo "mu4e elisp files not at $MU4E_DIR. Did you install the 'mu' package?"; exit 1; fi + +# does .mbsyncrc exist? +if ! [ -f $MBSYNCRC ]; then echo "necessary file .mbsyncrc not at $MBSYNCRC"; exit 1; fi + +# is msmtp installed? +if ! [ -f $MSMTP ]; then echo "msmtp not installed at $MSMTP. Install package 'msmtp and msmtp-mta' to continue"; exit 1; fi + +# does .msmtprc exist +if ! [ -f $MSMPTRC ]; then echo "necessary file .msmtprc not at $MBSYNCRC"; exit 1; fi + +# if mail directories don't exist, create them +if ! [ -f $GMAIL ]; then echo "creating gmail directory" && mkdir -p $GMAIL; fi +if ! [ -f $CMAIL ]; then echo "creating cmail directory" && mkdir -p $CMAIL; fi + +# -------------------------- Initial Sync ------------------------- + +# sync +echo "syncing email... Note: You will be asked for your password." +$MBSYNC -aV + +# init +echo "running mu init.." +$MU init --maildir=~/.mail --my-address=craigmartinjennings@gmail.com --my-address=c@cjennings.net + +# index +echo "running mu index..." +$MU index + +# report completion +echo "" && echo "Mu4e mail setup script completed." && echo "" && echo "" -- cgit v1.2.3