Skip to content
This repository has been archived by the owner on Aug 5, 2024. It is now read-only.

fix: email in dev env should not use fakeMailer to send email #2346

Merged
merged 2 commits into from
Jan 17, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
26 changes: 15 additions & 11 deletions src/config/email.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,7 @@ const {
SIB_APIKEY_PRIVATE,
} = EMAIL_CONFIG;

if (process.env.NODE_ENV === 'production') {
if (process.env.NODE_ENV !== 'test') {
try {
const sendInBlue = makeSendinblue({
MAIL_SENDER,
Expand Down Expand Up @@ -144,16 +144,20 @@ if (process.env.NODE_ENV === 'production') {
console.log('Emails will be sent using Nodemailer');
}
sendEmail = emailer.sendEmail;
sendCampaignEmail = sendInBlue.sendCampaignEmail;
addContactsToMailingLists = sendInBlue.addContactsToMailingLists;
removeContactsFromMailingList = sendInBlue.removeContactsFromMailingList;
updateContactEmail = sendInBlue.updateContactEmail;
smtpBlockedContactsEmailDelete = sendInBlue.smtpBlockedContactsEmailDelete;
getAllTransacBlockedContacts = sendInBlue.getAllTransacBlockedContacts;
getAllContacts = sendInBlue.getAllContacts;
getAllContactsFromList = sendInBlue.getAllContactsFromList;
unblacklistContactEmail = sendInBlue.unblacklistContactEmail;
getContactInfo = sendInBlue.getContactInfo;
if (process.env.NODE_ENV === 'production') {
// in dev we still use fakeEmailService
sendCampaignEmail = sendInBlue.sendCampaignEmail;
addContactsToMailingLists = sendInBlue.addContactsToMailingLists;
removeContactsFromMailingList = sendInBlue.removeContactsFromMailingList;
updateContactEmail = sendInBlue.updateContactEmail;
smtpBlockedContactsEmailDelete =
sendInBlue.smtpBlockedContactsEmailDelete;
getAllTransacBlockedContacts = sendInBlue.getAllTransacBlockedContacts;
getAllContacts = sendInBlue.getAllContacts;
getAllContactsFromList = sendInBlue.getAllContactsFromList;
unblacklistContactEmail = sendInBlue.unblacklistContactEmail;
getContactInfo = sendInBlue.getContactInfo;
}
} catch (e) {
console.error(e);
process.exit(1);
Expand Down
Loading