diff --git a/backend/src/api/helpers.ts b/backend/src/api/helpers.ts index 004b31da4..ed12e5132 100644 --- a/backend/src/api/helpers.ts +++ b/backend/src/api/helpers.ts @@ -154,47 +154,12 @@ export const sendUserNotificationEmail = async ( SES: new SES({ region: 'us-east-1' }) }); - /*const client = new S3Client(); - const html = await client.getEmailAsset(template_file); - - - const template = handlebars.compile(html); - const data = { - first_name: p_firstName, - last_name: p_lastname - }; - - const htmlToSend = template(data);*/ - - const mailOptions = { - from: process.env.CROSSFEED_SUPPORT_EMAIL_SENDER, - to: recepient, - subject: p_subject, - text: 'Testing' - }; - - await transporter.sendMail(mailOptions); -}; - -export const sendRegionalAdminNotificationEmail = async ( - recepient: string, - p_subject: string, - p_firstName: string, - p_lastname: string, - p_username: string -) => { - const transporter = nodemailer.createTransport({ - SES: new SES({ region: 'us-east-1' }) - }); - const client = new S3Client(); - const html = await client.getEmailAsset( - 'crossfeed_regional_admin_notification.html' - ); + const html = await client.getEmailAsset(template_file); const template = handlebars.compile(html); const data = { - first_name: p_firstName, - last_name: p_lastname + firstName: p_firstName, + lastName: p_lastname }; const htmlToSend = template(data); @@ -204,6 +169,7 @@ export const sendRegionalAdminNotificationEmail = async ( to: recepient, subject: p_subject, html: htmlToSend, + replyTo: process.env.CROSSFEED_SUPPORT_EMAIL_REPLYTO!, attachments: [ { filename: 'banner.png', @@ -232,7 +198,7 @@ export const sendRegionalAdminNotificationEmail = async ( }, { filename: 'facebook.png', - content: await client.getEmailAsset('facebooK.png'), + content: await client.getEmailAsset('facebook.png'), cid: 'CISA Facebook' }, { diff --git a/backend/src/api/users.ts b/backend/src/api/users.ts index b610e2cb4..e6771eabc 100644 --- a/backend/src/api/users.ts +++ b/backend/src/api/users.ts @@ -610,9 +610,9 @@ export const register = wrapHandler(async (event) => { // ); // Send Basic Text Registration confirmation email to user - await sendRegistrationTextEmail(newUser.email); + // await sendRegistrationTextEmail(newUser.email); // Send Basic HTML Registration confirmation email to user - await sendRegistrationHtmlEmail(newUser.email); + // await sendRegistrationHtmlEmail(newUser.email); // Send new user pending approval email to regionalAdmin // TODO: replace with html email function to regianlAdmin if desired @@ -673,12 +673,12 @@ export const registrationApproval = wrapHandler(async (event) => { } // Send email notification - sendUserNotificationEmail( + await sendUserNotificationEmail( user.email, - 'Crossfeed Registration Approved', + 'Crossfeed Registration Pending', user.firstName, user.lastName, - '/app/src/email_templates/crossfeed_approval_notification.html' + 'crossfeed_registration_notification.html' ); // TODO: Handle Response Output diff --git a/backend/src/email_templates/email_templates/crossfeed_approval_notification.html b/backend/src/email_templates/email_templates/crossfeed_approval_notification.html index 0d9ee4cbb..632ecfad7 100644 --- a/backend/src/email_templates/email_templates/crossfeed_approval_notification.html +++ b/backend/src/email_templates/email_templates/crossfeed_approval_notification.html @@ -64,7 +64,7 @@
{{firstname}} {{lastname}},
+{{firstName}} {{lastName}},
{{firstname}} {{lastname}},
+{{firstName}} {{lastName}},
{{firstname}} {{lastname}},
+{{firstName}} {{lastName}},