diff --git a/config/default.toml b/config/default.toml index c8221930..54b26e6e 100644 --- a/config/default.toml +++ b/config/default.toml @@ -105,3 +105,7 @@ enabled=false port=5699 # allow connections from localhost only host="127.0.0.1" + +# extra options for nodemailer +[nodemailer] +#textEncoding="base64" diff --git a/lib/mailer.js b/lib/mailer.js index 6c568d1b..0decf469 100644 --- a/lib/mailer.js +++ b/lib/mailer.js @@ -1,7 +1,7 @@ 'use strict'; let log = require('npmlog'); - +let config = require('config'); let nodemailer = require('nodemailer'); let openpgpEncrypt = require('nodemailer-openpgp').openpgpEncrypt; let settings = require('./models/settings'); @@ -155,7 +155,7 @@ function createMailer(callback) { tls: { rejectUnauthorized: !configItems.smtpSelfSigned } - }); + }, config.nodemailer); module.exports.transport.use('stream', openpgpEncrypt({ signingKey: configItems.pgpPrivateKey, passphrase: configItems.pgpPassphrase diff --git a/setup/adduser.sh b/setup/adduser.sh new file mode 100644 index 00000000..d32e6e49 --- /dev/null +++ b/setup/adduser.sh @@ -0,0 +1,36 @@ +#!/bin/bash + +# This installation script works on Ubuntu 14.04 and 16.04 +# Run as root! + +if [[ $EUID -ne 0 ]]; then + echo "This script must be run as root" 1>&2 + exit 1 +fi + +set -e + +export DEBIAN_FRONTEND=noninteractive + +# Setup MySQL user for Mailtrain +mysql -u root --password="$ROOT_PASS" -e "CREATE USER '$DB_USER'@'localhost' IDENTIFIED BY '$DB_PASS';" +mysql -u root --password="$ROOT_PASS" -e "GRANT ALL PRIVILEGES ON '$DB_USER'.* TO '$DB_USER'@'localhost';" +mysql -u "$DB_USER" --password="$DB_PASS" -e "CREATE database $DB_USER;" + +mysql -u "$DB_USER" -p"$DB_PASS" "$DB_USER" < setup/sql/mailtrain.sql + +mysql -u mailtrain -p"$MYSQL_PASSWORD" mailtrain <