diff --git a/mutt/.mutt/muttrc b/mutt/.mutt/muttrc index 1c9d238..19b0fc0 100644 --- a/mutt/.mutt/muttrc +++ b/mutt/.mutt/muttrc @@ -3,7 +3,7 @@ # Change the following six lines to match your Gmail account details set imap_user = "%GMAIL_LOGIN%" set imap_pass = "%GMAIL_PASS%" # leave blank for prompt -set smtp_url = "smtps://$imap_user@smtp.gmail.com:465/" +set smtp_url = "smtps://$imap_user@%SMTP_SERVER%:465/" set smtp_pass = "$imap_pass" # leave blank for prompt set from = "%GMAIL_FROM%" set realname = "%GMAIL_NAME%" @@ -30,7 +30,7 @@ bind pager next-line set resolve = no # uh, don't randomly take me to other messages when I do things # Basic config, you can leave this as is -set folder = "imaps://imap.gmail.com:993" +set folder = "imaps://%IMAP_SERVER%" set spoolfile = "+INBOX" set imap_check_subscribed set hostname = gmail.com @@ -50,14 +50,6 @@ set sort = 'reverse-threads' set sort_aux = 'last-date-received' set auto_tag = yes -# sane gpg settings to be a good encryption -# social citizen of the world -set pgp_replyencrypt # auto encrypt replies to encrypted mail -set pgp_replysign # auto sign replies to signed mail -set pgp_replysignencrypted # auto sign & encrypt to signed & encrypted mail -set pgp_show_unusable=no # show which keys are no good anymore -set pgp_autosign # auto sign emails - ignore "Authentication-Results:" ignore "DomainKey-Signature:" ignore "DKIM-Signature:" diff --git a/mutt/entrypoint.sh b/mutt/entrypoint.sh index e6b869b..96cc015 100755 --- a/mutt/entrypoint.sh +++ b/mutt/entrypoint.sh @@ -1,7 +1,7 @@ #!/bin/bash set -e -if [ ! "$GMAIL" ]; then +if [[ -z "$GMAIL" ]]; then echo >&2 'error: missing GMAIL environment variable' echo >&2 ' try running again with -e GMAIL=your-email@gmail.com' echo >&2 ' optionally, you can also specify -e GMAIL_PASS' @@ -10,34 +10,55 @@ if [ ! "$GMAIL" ]; then exit 1 fi -if [ ! "$GMAIL_NAME" ]; then +if [[ -z "$GMAIL_NAME" ]]; then GMAIL_NAME="$GMAIL" fi -if [ ! "$GMAIL_FROM" ]; then +if [[ -z "$GMAIL_FROM" ]]; then GMAIL_FROM="$GMAIL" fi -sed -i "s/%GMAIL_LOGIN%/$GMAIL/g" "$HOME/.mutt/muttrc" -sed -i "s/%GMAIL_NAME%/$GMAIL_NAME/g" "$HOME/.mutt/muttrc" -sed -i "s/%GMAIL_PASS%/$GMAIL_PASS/g" "$HOME/.mutt/muttrc" -sed -i "s/%GMAIL_FROM%/$GMAIL_FROM/g" "$HOME/.mutt/muttrc" +if [[ -z "$IMAP_SERVER" ]]; then + IMAP_SERVER="imap.gmail.com:993" +fi -if [ -d "$HOME/.gnupg" ]; then +if [[ -z "$SMTP_SERVER" ]]; then + SMTP_SERVER="smtp.gmail.com" +fi + +sed -i "s/%GMAIL_LOGIN%/$GMAIL/g" "$HOME/.mutt/muttrc" +sed -i "s/%GMAIL_NAME%/$GMAIL_NAME/g" "$HOME/.mutt/muttrc" +sed -i "s/%GMAIL_PASS%/$GMAIL_PASS/g" "$HOME/.mutt/muttrc" +sed -i "s/%GMAIL_FROM%/$GMAIL_FROM/g" "$HOME/.mutt/muttrc" +sed -i "s/%IMAP_SERVER%/$IMAP_SERVER/g" "$HOME/.mutt/muttrc" +sed -i "s/%SMTP_SERVER%/$SMTP_SERVER/g" "$HOME/.mutt/muttrc" + +if [[ -d "$HOME/.gnupg" ]]; then + # sane gpg settings to be a good encryption + # social citizen of the world { echo echo 'source /usr/share/doc/mutt/examples/gpg.rc' - echo 'set pgp_use_gpg_agent = yes' - if [ "$GPG_ID" ]; then + if [[ ! -z "$GPG_ID" ]]; then echo "set pgp_sign_as = $GPG_ID" fi - echo 'set crypt_replysign = yes' - echo 'set crypt_replysignencrypted = yes' - echo 'set crypt_verify_sig = yes' - } >> "$HOME/.muttrc" + echo 'set crypt_replysign=yes' + echo 'set crypt_replysignencrypted=yes' + echo 'set crypt_verify_sig=yes' + # auto encrypt replies to encrypted mail + echo 'set pgp_replyencrypt=yes' + # auto sign replies to signed mail + echo 'set pgp_replysign=yes' + # auto sign & encrypt to signed & encrypted mail + echo 'set pgp_replysignencrypted=yes' + # show which keys are no good anymore + echo 'set pgp_show_unusable=no' + # auto sign emails + echo 'set pgp_autosign=yes' + } >> "$HOME/.mutt/muttrc" fi -if [ -e "$HOME/.muttrc.local" ]; then +if [[ -e "$HOME/.muttrc.local" ]]; then echo "source $HOME/.muttrc.local" >> "$HOME/.mutt/muttrc" fi