mirror of
https://github.com/TryGhost/Ghost.git
synced 2025-02-10 23:36:14 -05:00
Supported unsubscribe_url template variable for bulk email
no-issue
This commit is contained in:
parent
00db1d385c
commit
509682cd6a
1 changed files with 4 additions and 1 deletions
|
@ -19,13 +19,16 @@ module.exports = {
|
||||||
/**
|
/**
|
||||||
* @param {Email} message - The message to send
|
* @param {Email} message - The message to send
|
||||||
* @param {[EmailAddress]} recipients - the recipients to send the email to
|
* @param {[EmailAddress]} recipients - the recipients to send the email to
|
||||||
|
* @param {[object]} recipientData - list of data keyed by email to inject into the email
|
||||||
* @returns {Promise<boolean>} A promise representing the success of the email sending
|
* @returns {Promise<boolean>} A promise representing the success of the email sending
|
||||||
*/
|
*/
|
||||||
async send(message, recipients) {
|
async send(message, recipients, recipientData) {
|
||||||
for (const recipient of recipients) {
|
for (const recipient of recipients) {
|
||||||
const messageToSend = Object.assign({}, message, {
|
const messageToSend = Object.assign({}, message, {
|
||||||
to: recipient
|
to: recipient
|
||||||
});
|
});
|
||||||
|
const unsubscribeUrl = recipientData[recipient].unsubscribe_url;
|
||||||
|
messageToSend.html = messageToSend.html.replace('%recipient.unsubscribe_url%', unsubscribeUrl);
|
||||||
try {
|
try {
|
||||||
await ghostMailer.send(messageToSend);
|
await ghostMailer.send(messageToSend);
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
|
|
Loading…
Add table
Reference in a new issue