Code Monkey home page Code Monkey logo

mbop-send-email-poc's Introduction

POST /sendEmail POC

This is a small POC for emulating BOP's /sendEmail endpoint.

Took the openapi spec and created a struct in the mailer/ package as well as the implementation to send a message from there using the AWS SES service.

Layout

The base HTTP server/handler are in main.go, basically all the handler does is:

  • Parse the JSON request body to mailer.Emails struct
  • Instantiate a Emailer to send them, using the configured MAILER_MODULE in the environment (currently only "aws" is supported)
    • mailer.NewMailer() (mailer.Mailer, error)
    • Looks at the AWS Config, returning an error if it wasn't initialized
  • Loops through the emails and sends them, logging any failures
    • mailer.SendEmail(context.Context, *mailler.Email) error

Questions

  • Bail out if one email fails to send?

Things TODO if we were to pull this in:

  • Register the "from" address in AWS SES, hopefully through terraform?
  • Create a sendEmailRequest struct to parse the body to -> then create the Email struct from that for safety
  • Parse the recipients to accept "Real Name" [email protected] since that format is in the examples for BOP
  • Lookup recipients by username, for same reason as above

mbop-send-email-poc's People

Watchers

 avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.