Various fixes.
This commit is contained in:
parent
dd9b8b464a
commit
83ce716d94
21 changed files with 99 additions and 114 deletions
|
@ -10,9 +10,9 @@ const crypto = require('crypto');
|
|||
let zoneMtaProcess;
|
||||
|
||||
const zoneMtaDir = path.join(__dirname, '..', '..', 'zone-mta');
|
||||
const zoneMtaBuiltingConfig = path.join(zoneMtaDir, 'config', 'builtin-zonemta.json')
|
||||
const zoneMtaBuiltingConfig = path.join(zoneMtaDir, 'config', 'builtin-zonemta.json');
|
||||
|
||||
const password = crypto.randomBytes(20).toString('hex').toLowerCase();
|
||||
const password = process.env.BUILTIN_ZONE_MTA_PASSWORD || crypto.randomBytes(20).toString('hex').toLowerCase();
|
||||
|
||||
function getUsername() {
|
||||
return 'mailtrain';
|
||||
|
|
|
@ -95,11 +95,18 @@ async function _sendMail(transport, mail, template) {
|
|||
}
|
||||
|
||||
async function _sendTransactionalMail(transport, mail, template) {
|
||||
const sendConfiguration = transport.mailer.sendConfiguration;
|
||||
|
||||
if (!mail.headers) {
|
||||
mail.headers = {};
|
||||
}
|
||||
mail.headers['X-Sending-Zone'] = 'transactional';
|
||||
|
||||
mail.from = {
|
||||
name: sendConfiguration.from_name,
|
||||
address: sendConfiguration.from_email
|
||||
};
|
||||
|
||||
const htmlRenderer = await tools.getTemplate(template.html, template.locale);
|
||||
|
||||
if (htmlRenderer) {
|
||||
|
|
|
@ -5,6 +5,7 @@ const log = require('./log');
|
|||
const path = require('path');
|
||||
const knex = require('./knex');
|
||||
const {CampaignStatus} = require('../../shared/campaigns');
|
||||
const builtinZoneMta = require('./builtin-zone-mta');
|
||||
|
||||
let messageTid = 0;
|
||||
let senderProcess;
|
||||
|
@ -16,7 +17,10 @@ function spawn(callback) {
|
|||
.then(() => {
|
||||
senderProcess = fork(path.join(__dirname, '..', 'services', 'sender-master.js'), [], {
|
||||
cwd: path.join(__dirname, '..'),
|
||||
env: {NODE_ENV: process.env.NODE_ENV}
|
||||
env: {
|
||||
NODE_ENV: process.env.NODE_ENV,
|
||||
BUILTIN_ZONE_MTA_PASSWORD: builtinZoneMta.getPassword()
|
||||
}
|
||||
});
|
||||
|
||||
senderProcess.on('message', msg => {
|
||||
|
|
|
@ -110,7 +110,7 @@ async function _sendMail(list, email, template, locale, subjectKey, relativeUrls
|
|||
const data = {
|
||||
title: list.name,
|
||||
homepage: configItems.defaultHomepage || getTrustedUrl(),
|
||||
contactAddress: list.from_email || configItems.adminEmail,
|
||||
contactAddress: list.contact_email || configItems.adminEmail,
|
||||
};
|
||||
|
||||
for (let relativeUrlKey in relativeUrls) {
|
||||
|
@ -140,10 +140,6 @@ async function _sendMail(list, email, template, locale, subjectKey, relativeUrls
|
|||
if (list.send_configuration) {
|
||||
const mailer = await mailers.getOrCreateMailer(list.send_configuration);
|
||||
await mailer.sendTransactionalMail({
|
||||
from: {
|
||||
name: configItems.defaultFrom,
|
||||
address: configItems.defaultAddress
|
||||
},
|
||||
to: {
|
||||
name: getDisplayName(flds, subscription),
|
||||
address: email
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue