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() {
s := resend.New(resend.WithSecurity(
shared.Security{
BearerAuth: "Bearer YOUR_BEARER_TOKEN_HERE",
},
))
req := operations.SendEmailRequest{
Request: shared.Email{
From: "[email protected]",
To: "[email protected]",
Subject: "Welcome to Resend!",
Text: "Hello, World!",
},
}
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 !