https://github.com/cmdotcom/email-sdk-golang
CM Email Gateway SDK for sending markering and transactional emails
https://github.com/cmdotcom/email-sdk-golang
Last synced: about 2 months ago
JSON representation
CM Email Gateway SDK for sending markering and transactional emails
- Host: GitHub
- URL: https://github.com/cmdotcom/email-sdk-golang
- Owner: cmdotcom
- License: mit
- Created: 2025-11-12T07:27:36.000Z (7 months ago)
- Default Branch: main
- Last Pushed: 2025-11-12T11:55:33.000Z (7 months ago)
- Last Synced: 2025-12-27T02:09:49.979Z (5 months ago)
- Language: Go
- Size: 7.81 KB
- Stars: 0
- Watchers: 0
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# CM Email Gateway API Golang package
Official API docs for Email Gateway API: https://developers.cm.com/messaging/docs/email-introduction
## Using the `emailgateway` package
[](https://pkg.go.dev/github.com/cmdotcom/email-sdk-golang/emailgateway)
### Installation
```shell
go get github.com/cmdotcom/email-sdk-golang
```
### Initialize client
```go
package main
import (
"os"
"github.com/cmdotcom/email-sdk-golang/emailgateway"
)
func main() {
client, err := emailgateway.NewClient(emailgateway.Config{
ProductToken: "your-product-token",
DefaultTransactionalPriority: emailgateway.PriorityHigh,
})
if err != nil {
panic(err)
}
}
```
### Sending an email
```go
// Client initialization code
email := emailgateway.Email{
From: emailgateway.Address{
Name: "CM.com",
Email: "no-reply@cm.com",
},
To: []emailgateway.Address{
{
Name: "Example Receiver",
Email: "email@example.com",
},
},
Subject: "My first emailgateway email",
HTMLBody: "
Hello world!
",
TextBody: "email",
}
response, err := client.SendTransactionalEmail(email)
if err != nil {
// Handle error
}
```