mail: add option to force from address for relays
This commit is contained in:
10
src/mail.js
10
src/mail.js
@@ -659,12 +659,14 @@ async function createMailConfig(mailFqdn, mailDomain) {
|
||||
port = relay.port || 25,
|
||||
authType = relay.username ? 'plain' : '',
|
||||
username = relay.username || '',
|
||||
password = relay.password || '';
|
||||
password = relay.password || '',
|
||||
forceFromAddress = relay.forceFromAddress ? 'true' : 'false';
|
||||
|
||||
if (!enableRelay) continue;
|
||||
|
||||
if (!safe.fs.appendFileSync(paths.MAIL_CONFIG_DIR + '/smtp_forward.ini',
|
||||
`[${domain.domain}]\nenable_outbound=true\nhost=${host}\nport=${port}\nenable_tls=true\nauth_type=${authType}\nauth_user=${username}\nauth_pass=${password}\n\n`, 'utf8')) {
|
||||
const relayData = `[${domain.domain}]\nenable_outbound=true\nhost=${host}\nport=${port}\nenable_tls=true\nauth_type=${authType}\nauth_user=${username}\nauth_pass=${password}\nforce_from_address=${forceFromAddress}\n\n`;
|
||||
|
||||
if (!safe.fs.appendFileSync(paths.MAIL_CONFIG_DIR + '/smtp_forward.ini', relayData, 'utf8')) {
|
||||
throw new BoxError(BoxError.FS_ERROR, `Could not create mail var file: ${safe.error.message}`);
|
||||
}
|
||||
}
|
||||
@@ -1042,7 +1044,7 @@ async function setMailRelay(domain, relay, options) {
|
||||
if (error) throw error;
|
||||
}
|
||||
|
||||
await updateDomain(domain, { relay: relay });
|
||||
await updateDomain(domain, { relay });
|
||||
|
||||
safe(restartMail(), { debug });
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user