This repository has been archived on 2024-04-07. You can view files and clone it, but cannot push or open issues or pull requests.
dotfiles/dotfiles/scripts/_mutt_get-mail

51 lines
998 B
Bash
Executable File

#!/bin/sh
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 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}/
set spoolfile = "+INBOX"
set record = "+Sent"
set postponed = "+Drafts"
set trash = "+Trash"
unmailboxes *
mailboxes \
`echo ~/.local/share/mail/${my_path}/INBOX*` \
"=Sent" \
"=Drafts" \
"=Trash" \
EOF