https://github.com/koding/kodingemail
https://github.com/koding/kodingemail
Last synced: 10 months ago
JSON representation
- Host: GitHub
- URL: https://github.com/koding/kodingemail
- Owner: koding
- Created: 2015-01-30T03:38:36.000Z (almost 11 years ago)
- Default Branch: master
- Last Pushed: 2016-07-21T22:42:21.000Z (over 9 years ago)
- Last Synced: 2025-01-20T10:11:31.150Z (11 months ago)
- Language: Go
- Size: 86.9 KB
- Stars: 1
- Watchers: 6
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: Readme.md
Awesome Lists containing this project
README
kodingemail
-----------
This library is a wrapper around sengrid's client meant to be used by koding workers.
Example:
// initialize sengrid client with auth, sets default from
// name and from address
client := kodingemail.InitializeSG(, )
// set substitution variables
sub := map[string]string{"planId" : "Free"}
err := client.SendTemplateEmail("to@koding.com", "template_id", sub)
if err != nil {
log.Fatal(err)
}
Included is a mock implementation of SGClient which can be used in tests:
// initialize test client
testSenderClient := &SenderTestClient{}
client := kodingemail.InitializeSG(, )
client.Client = testSenderClient
err := client.SendTemplateEmail("to@koding.com", "template_id", sub)
if err != nil {
log.Fatal(err)
}
// assert to field was set properly
if testSenderClient.Mail.To[0] != toEmail {
log.Fatal("To email wasn't set properly")
}