Skip to main content

Get

Retrieves an email with the given email ID.
func (s *EmailsSvcImpl) Get(emailId string) (*Email, error)

Parameters

emailId
string
required
The unique identifier of the email to retrieve.

Returns

response
*Email

Example

package main

import (
	"fmt"
	"github.com/resend/resend-go/v3"
)

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

	email, err := client.Emails.Get("4ef9a417-02e9-4d39-ad75-9611e0fcc33c")
	if err != nil {
		panic(err)
	}

	fmt.Printf("Email ID: %s\n", email.Id)
	fmt.Printf("From: %s\n", email.From)
	fmt.Printf("To: %v\n", email.To)
	fmt.Printf("Subject: %s\n", email.Subject)
	fmt.Printf("Created At: %s\n", email.CreatedAt)
	fmt.Printf("Last Event: %s\n", email.LastEvent)
}

GetWithContext

Retrieves an email with the given email ID and context.
func (s *EmailsSvcImpl) GetWithContext(ctx context.Context, emailId string) (*Email, error)

Parameters

ctx
context.Context
required
Context for the request.
emailId
string
required
The unique identifier of the email to retrieve.

Returns

response
*Email
See Get for response field details.

Example

package main

import (
	"context"
	"fmt"
	"github.com/resend/resend-go/v3"
)

func main() {
	ctx := context.Background()
	client := resend.NewClient("re_123456789")

	email, err := client.Emails.GetWithContext(ctx, "4ef9a417-02e9-4d39-ad75-9611e0fcc33c")
	if err != nil {
		panic(err)
	}

	fmt.Printf("Email ID: %s\n", email.Id)
	fmt.Printf("Subject: %s\n", email.Subject)
}

Build docs developers (and LLMs) love