The source code for this blog is available on GitHub.

Blog.

Brief journey of setting up graphql to send email using nodemailer and gmail

Cover Image for Brief journey of setting up graphql to send email using nodemailer and gmail
Jose KJ
Jose KJ

Used nodemailer package please checkout https://nodemailer.com/usage/

configured the follwoing in gmail the follwoing steps to successfully send email [copied from stackoverflow answer https://stackoverflow.com/a/73327545/19976827]

  1. Open Mail > Settings > See all Settings > Forwarding and POP/IMAP.
  2. Enable POP download: & Enable IMAP access: (then save the settings).
  3. Open Your Gmail Account > security > 2-step verification(enable it).
  4. Go to App Passwords > select device > select app(you can create any custom app).
  5. Copy App Password and use it in your application

just follow the node mailer sending mail doc, then add service, username, password, title, text, subject and then u are ready to send mails.... not that hard

other email services u can use are aws SES which has araound 62,000 emails per month if u call the from an ec2 instance.