fork 0k-charms
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

30 lines
712 B

  1. #!/bin/bash
  2. set -eux # -x for verbose logging to juju debug-log
  3. MAIL_NAME=${MAIL_NAME:-localhost}
  4. MAIL_DOMAINNAME=${MAIL_DOMAINNAME:-"localdomain"}
  5. MAIL_SATTELITE_RELAYHOST=${MAIL_SATTELITE_RELAYHOST:-}
  6. ##
  7. ## Mail facilities (install working 'mail' command)
  8. ##
  9. (
  10. debconf-set-selections <<< "postfix postfix/mailname string ${MAIL_NAME}.${MAIL_DOMAINNAME}" &&
  11. debconf-set-selections <<< "postfix postfix/main_mailer_type select 'Local only'" &&
  12. apt-get install -y postfix mailutils &&
  13. postconf inet_interfaces=loopback-only &&
  14. [ -z "$MAIL_SATTELITE_RELAYHOST" ] && postconf relayhost="$MAIL_SATTELITE_RELAYHOST"
  15. postfix reload
  16. )
  17. ##
  18. ## Test:
  19. ##
  20. # echo "test" | mail vaab@kal.fr