GithubHelp home page GithubHelp logo

forsam-education / hermes Goto Github PK

View Code? Open in Web Editor NEW
7.0 3.0 2.0 69 KB

A mailer meant to be used with a template bucket and a queue service.

License: MIT License

Go 100.00%
go mailer hermes sqs s3 aws lambda golang emailing mailer-service golang-application

hermes's Introduction

Hermes

CI GoDoc Go Report Card Version License: MIT

A simple project that handles sending e-mails through SMTP from a template storage system, using SQS messages, meant to be run on an AWS Lambda.

Quality assurance

To fix the basics of code format, you can run go fmt.

For a bit more advanced code style checks, you can run golint $(go list ./... | grep -v /vendor/). You'll have to run go get -u golang.org/x/lint/golint before.

Storage Connectors

There is two types of storage connectors:

  • AttachmentCopier
  • TemplateFetcher

You can create connectors that implements one or both of these interfaces.

We made the choice to make two interfaces because you may want to put your templates in one type of storage, and your attachments from another without the need to implement large interfaces.

At the moment, only the S3 Bucket connector is available but feel free to implement any other storage connector and make a pull request.

Templates naming

You need to have both HTML and plain text versions of a template, and store them using templatename.html.template and templatename.txt.template naming system.

You then only have to pass the template name in the SQS message, and it will get both versions.

Templates format

The templates are in the basic Go HTML Template and Go TEXT Template formats, and therefor you must use the {{.myVar}} notation, the var_name being the key of your data in the template_context json object.

Environment Variables

You have to configure the SMTP server connection details and the S3 template bucket using environment variables.

You can customise their names in the config structure, in main.go, specifically if you implement a new storage connector.

Call process

When deployed, this lambda has to subscribe to an SQS queue that will transport the messages containing the informations about the mails to send.

Here is an example of message body to send:

{
  "from_address": "[email protected]",
  "from_name": "Example Name",
  "reply_to": "[email protected]",
  "to_address": "[email protected]",
  "subject": "This is my subject",
  "template_name": "template-example",
  "template_context": {
    "myVar": "value"
  },
  "bcc": ["[email protected]"],
  "cc": ["[email protected]"],
  "attachments": [
    "invoice.pdf",
    "test.txt"
  ]
}

hermes's People

Contributors

dependabot-preview[bot] avatar dependabot[bot] avatar fossabot avatar qraimbault avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

Forkers

fossabot amasser

hermes's Issues

Dependabot can't resolve your Go dependency files

Dependabot can't resolve your Go dependency files.

As a result, Dependabot couldn't update your dependencies.

The error Dependabot encountered was:

github.com/forsam-education/hermes/mailmessage: cannot find module providing package github.com/forsam-education/hermes/mailmessage
github.com/forsam-education/hermes imports
	github.com/forsam-education/hermes/storage: cannot find module providing package github.com/forsam-education/hermes/storage

If you think the above is an error on Dependabot's side please don't hesitate to get in touch - we'll do whatever we can to fix it.

View the update logs.

Dependabot can't resolve your Go dependency files

Dependabot can't resolve your Go dependency files.

As a result, Dependabot couldn't update your dependencies.

The error Dependabot encountered was:

github.com/forsam-education/hermes/mailmessage: cannot find module providing package github.com/forsam-education/hermes/mailmessage
	github.com/forsam-education/hermes/storage: cannot find module providing package github.com/forsam-education/hermes/storage

If you think the above is an error on Dependabot's side please don't hesitate to get in touch - we'll do whatever we can to fix it.

View the update logs.

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.