Skip to content
This repository has been archived by the owner on May 17, 2023. It is now read-only.

resend/archived-resend-go

Repository files navigation

Resend is the email platform for developers.

SDK Installation

go get github.com/resendlabs/resend-go

Authentication

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

SDK Example Usage

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: "hello@resend.com",
            To: "thefuture@yourcompany.com",
            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
    }
}

SDK Available Operations

Email

  • SendEmail - Send an email

Contributions

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 !

SDK Generated by Speakeasy