Skip to content

Latest commit

 

History

History
executable file
·
50 lines (44 loc) · 1.07 KB

USAGE.md

File metadata and controls

executable file
·
50 lines (44 loc) · 1.07 KB
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
    }
}