Go

Official MailsSetu Go SDK. Production client for email, inbound workflows, and webhooks.

Installation

bash
go get github.com/mailsetu/mailsetu-go

Setup

go
package main

import (
    "fmt"
    "log"
    "os"
    mailsetu "github.com/mailsetu/mailsetu-go"
)

func main() {
    client := mailsetu.New(os.Getenv("MAILSETU_API_KEY"), "")
    // ...
}

Send an email

go
resp, err := client.Emails.Send(mailsetu.SendEmailRequest{
    From:    "Acme <noreply@acme.co>",
    To:      []string{"user@example.com"},
    Subject: "Welcome to Acme!",
    HTML:    "<h1>Welcome!</h1>",
    Text:    "Welcome!",
})
if err != nil {
    log.Fatal(err)
}
fmt.Println(resp.ID)     // email-xxxxxxxxxxxxxxxx
fmt.Println(resp.Status) // queued