🚀 Big News: Socket Acquires Coana to Bring Reachability Analysis to Every Appsec Team.Learn more
Socket
DemoInstallSign in
Socket

github.com/microapis/email-api

Package Overview
Dependencies
Alerts
File Explorer
Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

github.com/microapis/email-api

v0.0.0-20200922153546-f08292507a32
Source
Go
Version published
Created
Source

Messages Email API

Microservice implemented from Messages Core is responsible for sending emails through several providers such as Sendgrid, Mandrill or AWS SES.

As explained in the Messages Core repository, it can be seen that there are three models, messages, channel and provider. To know more you can read the readme of Messages Core.

Channels

Corresponds to the type of notification that could be sent, for this there must be the implementation of that channel as a gRPC service through an API.

Providers

The provider is an attribute of channel and allows to identify what types of messages are available for a specific channel.

In this api we will find the implementation of only 3 providers. Find Providers implementation at the ./provider folder.

NameDescriptionENV (each with prefix PROVIDER_)
SendgridFree Send 40,000 month.SENDGRID_API_KEY: string
MandrillFree Send 10,000 month.MANDRIL_API_KEY: string
AWS SES$0.10 for every 1,000 emails.SES_AWS_KEY_ID, SES_AWS_SECRET_KEY, SES_AWS_REGION: string

Model

Email {
  from:       string
  from_name:  string
  to:         []string
  reply_to:   []string
  subject:    string
  text:       string
  html:       string
  provider:   string  // sendgrid, mandrill, ses
}

Service methods

Send(e *email.Message, delay int64) (string, error): send email message with delay, use delay=0 for send right now.

Get(ID string) (*email.Message, error): get email message by id.

Update(ID string, e *email.Message) error: update email message by id.

Cancel(ID string) error: cancel email message by id.

Environments Values

HOST: define email service host.

PORT: define email service port.

REDIS_HOST: define redis host.

REDIS_PORT: define redis port.

REDIS_DATABASE: define redis database number.

PROVIDERS: define string with providers separated by comma.

PROVIDER_SENDGRID_API_KEY: define sendgrid provider api key.

PROVIDER_MANDRILL_API_KEY: define mandrill provider api key.

PROVIDER_SES_AWS_KEY_ID: define aws key id.

PROVIDER_SES_AWS_SECRET_KEY: define aws secret key.

PROVIDER_SES_AWS_REGION: define aws region.

Commands (Development)

make build: build restaurants service for osx.

make linux: build restaurants service for linux os.

make docker .: build docker.

make compose: start docker-docker.

make stop: stop docker-docker.

make run: run email service.

docker run -it -p 5030:5030 email-api: run docker.

FAQs

Package last updated on 22 Sep 2020

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts