mirror of
https://github.com/TryGhost/Ghost.git
synced 2025-01-02 07:43:11 +03:00
Supported unsubscribe_url template variable for bulk email
no-issue
This commit is contained in:
parent
00db1d385c
commit
509682cd6a
@ -19,13 +19,16 @@ module.exports = {
|
||||
/**
|
||||
* @param {Email} message - The message to send
|
||||
* @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
|
||||
*/
|
||||
async send(message, recipients) {
|
||||
async send(message, recipients, recipientData) {
|
||||
for (const recipient of recipients) {
|
||||
const messageToSend = Object.assign({}, message, {
|
||||
to: recipient
|
||||
});
|
||||
const unsubscribeUrl = recipientData[recipient].unsubscribe_url;
|
||||
messageToSend.html = messageToSend.html.replace('%recipient.unsubscribe_url%', unsubscribeUrl);
|
||||
try {
|
||||
await ghostMailer.send(messageToSend);
|
||||
} catch (err) {
|
||||
|
Loading…
Reference in New Issue
Block a user