Skip to main content
Resend Docs
current

Search documentation

Type to search this documentation.

On this pageOverview

Send emails with Go

Learn how to send your first email using the Resend Go SDK.

Before you start, you'll need:

  1. Install

    Get the Resend Go SDK.

    bash
    go get github.com/resend/resend-go/v4
  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/v4"
    )
    
    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)
    }
Suggest an edit

Propose a replacement for this page. The site team reviews it before applying any changes.

Export
Documentation menu