#!/bin/bash -l # Copyright (C) 2016 Ian Kelling # This program is under GPL v. 3 or later, see set -eE -o pipefail trap 'echo "$0:$LINENO:error: \"$BASH_COMMAND\" returned $?" >&2' ERR # dunno why debian installed postfix with builddep emacs # but I will just explicitly install it here since # I use it for sending mail in emacs. if private-host; then relayhost="[mail.messagingengine.com]:587" else # ses initially suggests port 25, but I had problems connecting to that. relayhost="[email-smtp.us-west-2.amazonaws.com]:587" fi if isdeb; then s debconf-set-selections</dev/null; then forward=$HOSTNAME@$PERSONAL_DOMAIN else forward=$HOSTNAME@$IMPERSONAL_DOMAIN fi e $forward > ~/.forward e $forward | s tee /root/.forward s newaliases # if I wanted the from address to be renamed and sent to a different address, # echo "sdx@localhost development@localhost" | sudo dd of=/etc/postfix/recipient_canonical # sudo postmap hash:/etc/postfix/recipient_canonical # sudo service postfix reload # i'm assuming mail just won't work on systems without the sasl_passwd. postconfin <<'EOF' smtp_sasl_auth_enable = yes smtp_sasl_password_maps = hash:/etc/postfix/sasl_passwd smtp_sasl_security_options = noanonymous smtp_tls_security_level = secure message_size_limit = 20480000 smtp_tls_CAfile = /etc/ssl/certs/ca-certificates.crt EOF # ^ I ran into a log file not sending cuz of size. double from 10 to 20 meg limit s postmap hash:/etc/postfix/sasl_passwd # offlineimap uses this too, it is much easier to use one location than to # condition it's config and postfix's config case $distro in fedora) s lnf -T ca-certificates.crt /etc/ssl/ca-bundle.trust.crt ;; *) : esac s service postfix reload sgo postfix