mirror of
https://github.com/TryGhost/Ghost.git
synced 2025-01-06 02:44:33 +03:00
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
ghost
core/test/integration/services
email-addresses/src
email-service/lib
@ -262,14 +262,14 @@ describe('Email addresses', function () {
|
|||||||
assertFromAddress('"Default Address" <default@sendingdomain.com>', 'support@address.com');
|
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({
|
await configureNewsletter({
|
||||||
sender_email: 'anything@possible.com',
|
sender_email: 'anything@possible.com',
|
||||||
sender_name: 'Anything Possible',
|
sender_name: 'Anything Possible',
|
||||||
sender_reply_to: 'newsletter'
|
sender_reply_to: 'newsletter'
|
||||||
});
|
});
|
||||||
await sendNewsletter();
|
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 () {
|
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');
|
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({
|
await configureNewsletter({
|
||||||
sender_email: 'anything@possible.com',
|
sender_email: 'anything@possible.com',
|
||||||
sender_name: 'Anything Possible',
|
sender_name: 'Anything Possible',
|
||||||
sender_reply_to: 'newsletter'
|
sender_reply_to: 'newsletter'
|
||||||
});
|
});
|
||||||
await sendNewsletter();
|
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 () {
|
it('[NEWSLETTER] Does allow to set the replyTo address to any address', async function () {
|
||||||
|
@ -131,6 +131,7 @@ export class EmailAddressService {
|
|||||||
from: address.from
|
from: address.from
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
return address;
|
return address;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -212,22 +212,19 @@ class EmailRenderer {
|
|||||||
* @returns {string|null}
|
* @returns {string|null}
|
||||||
*/
|
*/
|
||||||
getReplyToAddress(post, newsletter) {
|
getReplyToAddress(post, newsletter) {
|
||||||
if (newsletter.get('sender_reply_to') === 'support') {
|
const replyToAddress = newsletter.get('sender_reply_to');
|
||||||
|
|
||||||
|
if (replyToAddress === 'support') {
|
||||||
return this.#settingsHelpers.getMembersSupportAddress();
|
return this.#settingsHelpers.getMembersSupportAddress();
|
||||||
}
|
}
|
||||||
if (newsletter.get('sender_reply_to') === 'newsletter') {
|
|
||||||
if (this.#emailAddressService.managedEmailEnabled) {
|
if (replyToAddress === 'newsletter' && !this.#emailAddressService.managedEmailEnabled) {
|
||||||
// Don't duplicate the same replyTo addres if it already in the FROM address
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
return this.getFromAddress(post, newsletter);
|
return this.getFromAddress(post, newsletter);
|
||||||
}
|
}
|
||||||
|
|
||||||
const addresses = this.#emailAddressService.getAddress({
|
const addresses = this.#emailAddressService.getAddress({
|
||||||
from: this.#getRawFromAddress(post, newsletter),
|
from: this.#getRawFromAddress(post, newsletter),
|
||||||
replyTo: {
|
replyTo: replyToAddress === 'newsletter' ? undefined : {address: replyToAddress}
|
||||||
address: newsletter.get('sender_reply_to')
|
|
||||||
}
|
|
||||||
});
|
});
|
||||||
|
|
||||||
if (addresses.replyTo) {
|
if (addresses.replyTo) {
|
||||||
|
Loading…
Reference in New Issue
Block a user