./mvnw spring-boot:run Run the following commands in the root project directory
./mvnw clean install
docker build -t emailsender .
docker run -p 8080:8080 emailsender:latest Autogenerated API documentation is available when the service is running at http://localhost:8080/swagger-ui.html#/email-controller To change between snailgun and sendgrid change the spring.profiles.active value in applicaiton.properties to either sendgrid or snailgun I chose to write this in Java because it's the language I have the most familiarity with and it has good frameworks for quickly making REST services. creating REST services; I build this service in Springboot as that is the industry standard for Java REST services and a framework I have a great deal of familiarity with. I used this library for Email Addres Validation. The reason I decided to use a library rather than do it myself is that some cursory online research revealed that there are a ton of edge cases. I felt that this was a situation where it was better to not reinvent the wheel. I chose apache commons validator due to ease of use, but it is not completely comprehensive. I discuss some options for more comprehensive validators in the Future Improvements sections https://davidcel.is/posts/stop-validating-email-addresses-with-regex/
https://stackoverflow.com/questions/201323/how-to-validate-an-email-address-using-a-regular-expression I used Jsoup to help convert HTML to plaintext. I felt that, as with email address validation, There were a lot of edge cases and this is a common problem that existing libraries have already solved. I used the Gson library for JSON parsing. Mostly in tests but also to map snailguns snake case parameters to camel case I used this as a quick easy way to create API documentation. I used Maven as a build tool primarily due to familiarity. I could have also chosen to use Gradle and the differences between the two on a project like this are fairly minimal I created a Dockerfile because it is industry standard and I knew it could add it very quickly This is a pretty thin passthrough. It does a little bit of validation and then routes requests to the EmailService I created this to be a message class separate from individual messages based on Sendgrid or Snailgun