go get github.com/resendlabs/resend-go
To authenticate you need to add an Authorization header with the contents of the header being Bearer re_123456789 where re_123456789 is your API Key. First, you need to get an API key, which is available in the Resend Dashboard.
Authorization: Bearer re_123
package main
import (
"context"
"log"
"github.com/resendlabs/resend-go"
"github.com/resendlabs/resend-go/pkg/models/shared"
"github.com/resendlabs/resend-go/pkg/models/operations"
)
func main() {
opts := []resend.SDKOption{
resend.WithSecurity(
shared.Security{
BearerAuth: shared.SchemeBearerAuth{
Authorization: "Bearer YOUR_BEARER_TOKEN_HERE",
},
},
),
}
s := resend.New(opts...)
req := operations.SendEmailRequest{
Request: shared.Email{
Bcc: "unde",
Cc: "deserunt",
From: "porro",
HTML: "nulla",
ReplyTo: "id",
Subject: "vero",
Text: "perspiciatis",
To: "nulla",
},
}
ctx := context.Background()
res, err := s.Email.SendEmail(ctx, req)
if err != nil {
log.Fatal(err)
}
if res.SendEmailResponse != nil {
// handle response
}
}
SendEmail
- Send an email
While we value open-source contributions to this SDK, this library is generated programmatically. Feel free to open a PR or a Github issue as a proof of concept and we'll do our best to include it in a future release !