Skip to content

Commit 87c6ee7

Browse files
committed
adding sendgrid sender
1 parent d62b884 commit 87c6ee7

File tree

1 file changed

+29
-0
lines changed

1 file changed

+29
-0
lines changed

README.md

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
### Sendgrid Buffalo Sender
2+
3+
This is a [buffalo](github.com/gobuffalo/buffalo) sender for the [Sendgrid](https://https://sendgrid.com//) email service.
4+
5+
#### How to use
6+
7+
In your `mailers.go`
8+
9+
```
10+
import (
11+
...
12+
ssender "github.com/paganotoni/sendgrid-sender"
13+
)
14+
15+
var sender mail.Sender
16+
var hcomposer hermes.Hermes
17+
18+
func init() {
19+
serverToken := envy.Get("Sendgrid_SERVER_TOKEN", "")
20+
accountToken := envy.Get("Sendgrid_ACCOUNT_TOKEN", "")
21+
sender = ssender.NewSendgridSender(serverToken, accountToken, false)
22+
}
23+
```
24+
25+
And then in your mailers you would do the same `sender.Send(m)` as this sender matches buffalos [`mail.Sender`](https://github.com/gobuffalo/buffalo/blob/master/mail/mail.go#L4) interface.
26+
27+
#### Test mode
28+
29+
Whenever the GO_ENV variable is set to be `test` this sender will use [mocksmtp](https://github.com/stanislas-m/mocksmtp) sender to send messages, you can read values in your tests within the property `TestSender` of the SendgridSender.

0 commit comments

Comments
 (0)