Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add SES to send emails from web-backend #59

Merged
merged 1 commit into from
Jan 20, 2025
Merged

Add SES to send emails from web-backend #59

merged 1 commit into from
Jan 20, 2025

Conversation

MikkoKauhanen
Copy link
Contributor

@MikkoKauhanen MikkoKauhanen commented Jan 16, 2025

This PR introduces AWS SES to dev and QA environments with domain identity.

aoe-web-backend mailService has been changed to use AWS SDK V2 SES to send emails instead of node mailer.

After deployment the SES is in sandbox mode which means that only to verified emails aoe can send an email. For production we need to request production access once the SES is deployed.

@MikkoKauhanen MikkoKauhanen force-pushed the feat/SES branch 2 times, most recently from c680b5e to 454bee8 Compare January 16, 2025 14:24
@MikkoKauhanen MikkoKauhanen changed the title Add SES to send emails from web-backend WIP: Add SES to send emails from web-backend Jan 16, 2025
@MikkoKauhanen MikkoKauhanen force-pushed the feat/SES branch 5 times, most recently from 4d08486 to 0dfaff0 Compare January 17, 2025 08:39
Copy link
Contributor

@hsalokor hsalokor left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Muuten en keksinyt huomautettavaa, näyttää hyvältä

if (parseInt(process.env.SEND_EMAIL, 10)) {
const info: Record<string, unknown> = await transporter.sendMail(mailOptions);
winstonLogger.debug('System email notification delivery completed: ' + info);
if (parseInt(process.env.SEND_SYSTEM_NOTIFICATION_EMAIL, 10)) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Lisäisin tähän eksplisiittisen tarkistuksen luettavuuden vuoksi, tyyliin:

if (parseInt(process.env.SEND_SYSTEM_NOTIFICATION_EMAIL, 10) === 1) {

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

isEnabled funktio tehty joka tarkistaa onko env x arvo === '1'

if (!(process.env.SEND_EMAIL === '1')) {
winstonLogger.debug('Email sending disabled');
const emails = materials.filter((m) => m.email != undefined).map((m) => m.email);
if (!(process.env.SEND_EXPIRATION_NOTIFICATION_EMAIL === '1')) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sama kommentti liittyen eksplisiittiseen tarkistukseen

@@ -84,8 +111,8 @@ export async function sendRatingNotificationMail() {
holder[d.email] = d.materialname;
}
});
if (!(process.env.SEND_EMAIL === '1')) {
winstonLogger.debug('Email sending disabled');
if (!(process.env.SEND_RATING_NOTIFICATION === '1')) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Eksplisiittinen vertailu myös tähän

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

isEnabled funktio tehty joka tarkistaa onko env x arvo === '1'

winstonLogger.debug('Message sent: %s', info.messageId);
const content = await verificationEmailText(url);

if (process.env.SEND_VERIFICATION_EMAIL === '1') {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Tässä on sitten hieman eri tarkistus, joka on ok, mutta checkit voisi ehkä irrottaa apufunktioksi joka palauttaa boolean-arvon

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

isEnabled funktio tehty joka tarkistaa onko env x arvo === '1'

@hsalokor hsalokor changed the base branch from aws-migration to main January 17, 2025 19:44
@MikkoKauhanen MikkoKauhanen force-pushed the feat/SES branch 3 times, most recently from 628019a to f65c012 Compare January 20, 2025 08:30
@MikkoKauhanen MikkoKauhanen changed the title WIP: Add SES to send emails from web-backend Add SES to send emails from web-backend Jan 20, 2025
@MikkoKauhanen MikkoKauhanen merged commit 04605cb into main Jan 20, 2025
2 checks passed
@MikkoKauhanen MikkoKauhanen deleted the feat/SES branch January 21, 2025 07:03
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants