Skip to main content

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/v3

2. Send email using HTML

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

import (
	"fmt"

	"github.com/resend/resend-go/v3"
)

func main() {
    client := resend.NewClient("re_xxxxxxxxx")

    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

Basic Send

Basic email sending

Attachments

Send emails with file attachments

Inline Images (CID)

Embed inline images using CID

Templates

Send emails using Resend hosted templates

Scheduling

Schedule emails for future delivery

Prevent Threading

Prevent email threading on Gmail

Audiences

Manage contacts and audiences

Domains

Create and manage sending domains

Inbound Webhooks

Receive and process inbound emails

Double Opt-in

Double opt-in subscription flow

Chi App

Full Chi web framework application

Gin App

Full Gin web framework application