Fixed reply-to address to stay the same after dmarc changes (#19542)
fixes PROD-102 - after dmarc changes, replies from members should keep going to any previously set reply-to email address by the publisher
This commit is contained in:
parent
eb063f7a40
commit
5469e76852
@ -262,14 +262,14 @@ describe('Email addresses', function () {
|
||||
assertFromAddress('"Default Address" <default@sendingdomain.com>', 'support@address.com');
|
||||
});
|
||||
|
||||
it('[NEWSLETTER] Does not allow to send a newsletter from any configured email address, instead uses mail.from', async function () {
|
||||
it('[NEWSLETTER] Does not allow to send a newsletter from any email address (instead uses mail.from), but allows reply-to to be set', async function () {
|
||||
await configureNewsletter({
|
||||
sender_email: 'anything@possible.com',
|
||||
sender_name: 'Anything Possible',
|
||||
sender_reply_to: 'newsletter'
|
||||
});
|
||||
await sendNewsletter();
|
||||
await assertFromAddressNewsletter('"Anything Possible" <default@sendingdomain.com>');
|
||||
await assertFromAddressNewsletter('"Anything Possible" <default@sendingdomain.com>', '"Anything Possible" <anything@possible.com>');
|
||||
});
|
||||
|
||||
it('[NEWSLETTER] Does allow to send a newsletter from a custom sending domain', async function () {
|
||||
@ -358,14 +358,14 @@ describe('Email addresses', function () {
|
||||
assertFromAddress('"Example Site" <default@sendingdomain.com>', 'hello@acme.com');
|
||||
});
|
||||
|
||||
it('[NEWSLETTER] Does not allow to send a newsletter from any configured email address, instead uses mail.from', async function () {
|
||||
it('[NEWSLETTER] Does not allow to send a newsletter from any email address (instead uses mail.from), but allow reply-to to be set', async function () {
|
||||
await configureNewsletter({
|
||||
sender_email: 'anything@possible.com',
|
||||
sender_name: 'Anything Possible',
|
||||
sender_reply_to: 'newsletter'
|
||||
});
|
||||
await sendNewsletter();
|
||||
await assertFromAddressNewsletter('"Anything Possible" <default@sendingdomain.com>');
|
||||
await assertFromAddressNewsletter('"Anything Possible" <default@sendingdomain.com>', '"Anything Possible" <anything@possible.com>');
|
||||
});
|
||||
|
||||
it('[NEWSLETTER] Does allow to set the replyTo address to any address', async function () {
|
||||
|
@ -131,6 +131,7 @@ export class EmailAddressService {
|
||||
from: address.from
|
||||
};
|
||||
}
|
||||
|
||||
return address;
|
||||
}
|
||||
|
||||
|
@ -212,22 +212,19 @@ class EmailRenderer {
|
||||
* @returns {string|null}
|
||||
*/
|
||||
getReplyToAddress(post, newsletter) {
|
||||
if (newsletter.get('sender_reply_to') === 'support') {
|
||||
const replyToAddress = newsletter.get('sender_reply_to');
|
||||
|
||||
if (replyToAddress === 'support') {
|
||||
return this.#settingsHelpers.getMembersSupportAddress();
|
||||
}
|
||||
if (newsletter.get('sender_reply_to') === 'newsletter') {
|
||||
if (this.#emailAddressService.managedEmailEnabled) {
|
||||
// Don't duplicate the same replyTo addres if it already in the FROM address
|
||||
return null;
|
||||
}
|
||||
|
||||
if (replyToAddress === 'newsletter' && !this.#emailAddressService.managedEmailEnabled) {
|
||||
return this.getFromAddress(post, newsletter);
|
||||
}
|
||||
|
||||
const addresses = this.#emailAddressService.getAddress({
|
||||
from: this.#getRawFromAddress(post, newsletter),
|
||||
replyTo: {
|
||||
address: newsletter.get('sender_reply_to')
|
||||
}
|
||||
replyTo: replyToAddress === 'newsletter' ? undefined : {address: replyToAddress}
|
||||
});
|
||||
|
||||
if (addresses.replyTo) {
|
||||
|
Loading…
Reference in New Issue
Block a user