Updated test emails to fetch member data if email matches
no issue - with the email replacements feature it's useful to have real member data when sending test emails from the PSM - if the supplied email address matches a member then that member's data will be used for any replacements
This commit is contained in:
parent
d0393b6223
commit
e0e0a85a32
@ -93,9 +93,10 @@ const sendEmail = async (postModel, members) => {
|
||||
};
|
||||
|
||||
const sendTestEmail = async (postModel, toEmails) => {
|
||||
const recipients = toEmails.map((email) => {
|
||||
return {email};
|
||||
});
|
||||
const recipients = await Promise.all(toEmails.map(async (email) => {
|
||||
const member = await membersService.api.members.get({email});
|
||||
return member || {email};
|
||||
}));
|
||||
const {emailTmpl, emails, emailData} = await getEmailData(postModel, recipients);
|
||||
emailTmpl.subject = `[Test] ${emailTmpl.subject}`;
|
||||
return bulkEmailService.send(emailTmpl, emails, emailData);
|
||||
|
Loading…
Reference in New Issue
Block a user