Fixed missing domain for default support address

no issue

- By default for new sites, support address is set same as from address to `noreply` , with full email address using the domain for `@`
- For newsletter emails, the support address was missing the default site domain to be added to address if its `noreply`
- Fix updates the support address to use the same format as from address and add relevant domain for default case
This commit is contained in:
Rish 2020-09-03 10:30:09 +05:30 committed by Rishabh Garg
parent 91bca9f109
commit dd6ac57aca
3 changed files with 16 additions and 4 deletions

View File

@ -81,8 +81,10 @@ module.exports = {
}
const blogTitle = settingsCache.get('title') ? settingsCache.get('title').replace(/"/g, '\\"') : '';
const supportAddress = settingsCache.get('members_support_address');
const replyToAddress = (settingsCache.get('members_reply_address') === 'support') ? supportAddress : fromAddress;
let supportAddress = message.supportAddress;
delete message.supportAddress;
const replyAddressOption = settingsCache.get('members_reply_address');
const replyToAddress = (replyAddressOption === 'support') ? supportAddress : fromAddress;
fromAddress = blogTitle ? `"${blogTitle}"<${fromAddress}>` : fromAddress;
const chunkedRecipients = _.chunk(recipients, BATCH_SIZE);

View File

@ -17,6 +17,7 @@ const getEmailData = async (postModel, memberModels = []) => {
const {emailTmpl, replacements} = await postEmailSerializer.serialize(postModel);
emailTmpl.from = membersService.config.getEmailFromAddress();
emailTmpl.supportAddress = membersService.config.getEmailSupportAddress();
// update templates to use Mailgun variable syntax for replacements
replacements.forEach((replacement) => {

View File

@ -44,9 +44,18 @@ class MembersConfigProvider {
return fromAddress;
}
getEmailSupportAddress() {
const supportAddress = this._settingsCache.get('members_support_address') || 'noreply';
// Any fromAddress without domain uses site domain, like default setting `noreply`
if (supportAddress.indexOf('@') < 0) {
return `${supportAddress}@${this._getDomain()}`;
}
return supportAddress;
}
getAuthEmailFromAddress() {
const supportAddress = this._settingsCache.get('members_support_address');
return supportAddress || this.getEmailFromAddress();
return this.getEmailSupportAddress() || this.getEmailFromAddress();
}
getPublicPlans() {