Tools / Sendgrid-sender

Sendgrid-sender

Buffalo's sender implementation for Sendgrid in Go

Forks: 2
Watchers: 2
Stars: 2

Sendgrid Buffalo Sender

This is a buffalo sender for the Sendgrid email service.

How to use

In your mailers.go

import (
    ... 
    ssender "github.com/paganotoni/sendgrid-sender"
)

var sender mail.Sender

func init() {
	APIKey := envy.Get("SENDGRID_API_KEY", "")
	sender = ssender.NewSendgridSender(APIKey)
}

And then in your mailers you would do the same sender.Send(m) as this sender matches buffalos mail.Sender interface.

Test mode

Whenever the GO_ENV variable is set to be test this sender will use mocksmtp sender to send messages, you can read values in your tests within the property TestSender of the SendgridSender.

License: -