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

Commit

Permalink
fix: email in dev env should not use fakeMailer to send email (#2346)
Browse files Browse the repository at this point in the history
  • Loading branch information
LucasCharrier authored Jan 17, 2024
1 parent 6948b44 commit 03f0deb
Showing 1 changed file with 15 additions and 11 deletions.
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

0 comments on commit 03f0deb

Please sign in to comment.