freeCodeCamp icon indicating copy to clipboard operation
freeCodeCamp copied to clipboard

feat(api): email service

Open ojeytonwilliams opened this issue 1 year ago • 1 comments

Checklist:

With this plugin we can call fastify.sendEmail whenever we need to. The default email provider is SES, but it falls back to nodemailer in development.

Closes: https://github.com/freeCodeCamp/freeCodeCamp/issues/50498

ojeytonwilliams avatar Jun 08 '23 09:06 ojeytonwilliams

:eyes: Review this PR in a CodeSee Review Map

View the CodeSee Map of this change

Review these changes using an interactive CodeSee Map

Legend

CodeSee Map legend

ghost avatar Jun 08 '23 09:06 ghost

New dependencies detected. Learn more about Socket for GitHub ↗︎

Packages Version New capabilities Transitives Size Publisher
@types/nodemailer 6.4.9 None +0 89.3 kB types

socket-security[bot] avatar Jul 21 '23 10:07 socket-security[bot]

@oliver is this setup automatically during development or does is need to be manually started?

If that's the case it would be nice to have some documentation on how to use it.

Sembauke avatar Jul 27 '23 05:07 Sembauke

is this setup automatically during development or does is need to be manually started?

It's automatic. The EMAIL_PROVIDER controls it and is set to nodemailer in development, so new contributors don't have to do anything special.

Existing contributors will have to update their .env files, but that's standard whenever we add a new variable.

ojeytonwilliams avatar Jul 27 '23 13:07 ojeytonwilliams

Good point, that would not be consistent between dev and prod. We never want to be sending html, correct?

@naomi-lgbt is it as simple as

Text: {
     Charset: "UTF-8", 
     Data: "This is the message body in text format."
    }

where I put HTML? This is based on: https://docs.aws.amazon.com/AWSJavaScriptSDK/latest/AWS/SES.html#sendEmail-property

ojeytonwilliams avatar Jul 31 '23 19:07 ojeytonwilliams

We never want to be sending html, correct?

Yes - that is correct.

raisedadead avatar Jul 31 '23 19:07 raisedadead

naomi-lgbt is it as simple as

Yes, that is what we do in the email blast tool.

naomi-lgbt avatar Jul 31 '23 19:07 naomi-lgbt

@ojeytonwilliams we enabled JSDoc; please rebase when you get a moment and address any linting issues. Thanks.

raisedadead avatar Aug 03 '23 16:08 raisedadead

@naomi-lgbt once you are happy with comments, please resolve them.

raisedadead avatar Aug 04 '23 20:08 raisedadead