Documentation Index
Fetch the complete documentation index at: https://mintlify.com/resend/resend-go/llms.txt
Use this file to discover all available pages before exploring further.
Send
Sends an email with the given parameters.
func (s *EmailsSvcImpl) Send(params *SendEmailRequest) (*SendEmailResponse, error)
Parameters
params
*SendEmailRequest
required
The email parametersShow SendEmailRequest fields
Sender email address. Must be from a verified domain.
Recipient email addresses.
HTML version of the message.
Plain text version of the message.
Blind carbon copy recipients.
Custom metadata tags for the email.
File attachments for the email.
Binary content of the attachment. Use when Path is not available.
Filename that will appear in the email. Pick the correct extension for proper preview.
URL path where the attachment file is hosted instead of providing content directly.
Content type for the attachment. If not set, derived from the filename.
Optional content ID for inline attachments. Reference in HTML using cid: prefix.
Schedule email for future delivery. Format: ISO 8601 (e.g., “2024-09-05T11:52:01.858Z”).
Template configuration for the email.Show EmailTemplate fields
Template ID or alias to use for this email.
Key-value pairs to populate template placeholders.
Returns
Show SendEmailResponse fields
The unique identifier of the sent email.
Example
package main
import (
"fmt"
"github.com/resend/resend-go/v3"
)
func main() {
client := resend.NewClient("re_123456789")
params := &resend.SendEmailRequest{
From: "onboarding@resend.dev",
To: []string{"delivered@resend.dev"},
Subject: "Hello from Golang",
Text: "hello world",
Cc: []string{"cc@example.com"},
Bcc: []string{"bcc@example.com"},
ReplyTo: "to@example.com",
}
sent, err := client.Emails.Send(params)
if err != nil {
panic(err)
}
fmt.Printf("Email sent: %s\n", sent.Id)
}
SendWithContext
Sends an email with the given parameters and context.
func (s *EmailsSvcImpl) SendWithContext(ctx context.Context, params *SendEmailRequest) (*SendEmailResponse, error)
Parameters
params
*SendEmailRequest
required
The email parameters. See Send for field details.
Returns
See Send for response details.
Example
package main
import (
"context"
"fmt"
"github.com/resend/resend-go/v3"
)
func main() {
ctx := context.Background()
client := resend.NewClient("re_123456789")
params := &resend.SendEmailRequest{
From: "onboarding@resend.dev",
To: []string{"delivered@resend.dev"},
Subject: "Hello from Golang",
Text: "hello world",
}
sent, err := client.Emails.SendWithContext(ctx, params)
if err != nil {
panic(err)
}
fmt.Printf("Email sent: %s\n", sent.Id)
}
SendWithOptions
Sends an email with the given parameters, context, and additional options.
func (s *EmailsSvcImpl) SendWithOptions(ctx context.Context, params *SendEmailRequest, options *SendEmailOptions) (*SendEmailResponse, error)
Parameters
params
*SendEmailRequest
required
The email parameters. See Send for field details.
options
*SendEmailOptions
required
Additional options for sending the email.Show SendEmailOptions fields
Unique key to ensure idempotent email sending. Prevents duplicate sends.
Returns
See Send for response details.
Example
package main
import (
"context"
"fmt"
"github.com/resend/resend-go/v3"
)
func main() {
ctx := context.Background()
client := resend.NewClient("re_123456789")
params := &resend.SendEmailRequest{
From: "onboarding@resend.dev",
To: []string{"delivered@resend.dev"},
Subject: "Hello from Golang",
Text: "hello world",
}
options := &resend.SendEmailOptions{
IdempotencyKey: "unique-idempotency-key",
}
sent, err := client.Emails.SendWithOptions(ctx, params, options)
if err != nil {
panic(err)
}
fmt.Printf("Email sent: %s\n", sent.Id)
}