Skip to content

Instantly share code, notes, and snippets.

@sanderson
Last active March 15, 2018 22:26
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save sanderson/afd05daaf01fc5c9edde61f49abeaa33 to your computer and use it in GitHub Desktop.
Save sanderson/afd05daaf01fc5c9edde61f49abeaa33 to your computer and use it in GitHub Desktop.
Configuring Nanobox to Use nullmailer
# add nullmailer as an extra package
run.config:
...
extra_packages:
- nullmailer
# curl the setup-nullmailer script and run it as a transform hook
deploy.config:
transform:
- bash <(curl -sL https://git.io/vAgf3)
# start the nullmailer server in whatever component(s) is/are sending mail
web.site:
start:
mail: /data/libexec/nullmailer/nullmailer-send
SMTP_HOST=smtp-host
SMTP_PORT=smtp-port
SMTP_USER=smtp-username
SMTP_PASS=smtp-password
SMTP_TLS=tls|ssl
SMTP_AUTH=login|plain
#!/usr/bin/env bash
ln -sf /data/libexec/nullmailer/sendmail /data/bin/
mkdir -p /data/var/spool/nullmailer/{failed,queue}
mkfifo /data/var/spool/nullmailer/trigger
echo "${APP_NAME}" > /data/etc/nullmailer/defaulthost
echo "nanoapp.io" > /data/etc/nullmailer/defaultdomain
echo "${APP_NAME}.nanoapp.io" > /data/etc/nullmailer/me
echo "${SMTP_USER}" > /data/etc/nullmailer/adminaddr
if [[ -n "${SMTP_PORT}" ]]; then
options="--port=${SMTP_PORT}"
fi
if [[ "${SMTP_TLS}" == "tls" || "${SMTP_TLS}" == "ssl" ]]; then
options="${options} --tls"
elif [[ "${SMTP_TLS}" == "starttls" ]]; then
options="${options} --starttls"
fi
if [[ "${SMTP_AUTH}" == "login" ]]; then
options="${options} --auth-login"
fi
echo "${SMTP_HOST} smtp --user='${SMTP_USER}' --pass='${SMTP_PASS}' ${options}" > /data/etc/nullmailer/remotes
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment