Prerequisites

To get the most out of this guide, you’ll need to:

1. Install

Get the Resend Go SDK.

go get github.com/resend/resend-go/v2

2. Send email using HTML

The easiest way to send an email is by using the html parameter.

main.go
package main

import "github.com/resend/resend-go/v2"

func main() {
    apiKey = "re_123"

    client := resend.NewClient(apiKey)

    params := &resend.SendEmailRequest{
        From:    "Acme <onboarding@resend.dev>",
        To:      []string{"delivered@resend.dev"},
        Html:    "<strong>hello world</strong>",
        Subject: "Hello from Golang",
        Cc:      []string{"cc@example.com"},
        Bcc:     []string{"bcc@example.com"},
        ReplyTo: "replyto@example.com",
    }

    sent, err := client.Emails.Send(params)
    if err != nil {
        fmt.Println(err.Error())
        return
    }
    fmt.Println(sent.Id)
}

3. Try it yourself

Golang Examples

See the full source code.