Skip to main content
The Resend Go SDK allows you to schedule emails for future delivery, update scheduled send times, and cancel scheduled emails.

Quick Start

Here’s how to schedule an email for future delivery:

Scheduling Emails

Using ScheduledAt Field

Add the ScheduledAt field to your SendEmailRequest with an ISO 8601 formatted datetime:
Source: examples/schedule_email.go:17
string
ISO 8601 datetime string (e.g., 2024-09-05T11:52:01.858Z) specifying when the email should be sent.Must be in the future. The maximum scheduling window may vary - check Resend’s documentation for current limits.
Source: emails.go:40

Formatting Schedule Times

Use Go’s time package to generate properly formatted ISO 8601 timestamps:
The ScheduledAt time must be in the future. Emails with past timestamps will be rejected.

Updating Scheduled Emails

You can reschedule an email before it’s sent:
Source: examples/schedule_email.go:32

UpdateEmailRequest Fields

string
required
The ID of the scheduled email to update.
string
required
New ISO 8601 datetime for when the email should be sent.
Source: emails.go:55

Update Methods

Source: emails.go:230
You can only update emails that haven’t been sent yet. Once an email is sent, it cannot be modified.

Canceling Scheduled Emails

Cancel a scheduled email before it’s sent:
Source: examples/schedule_email.go:44

Cancel Methods

Source: emails.go:200

CancelScheduledEmailResponse

string
The ID of the canceled email.
string
Object type, typically "email".
Source: emails.go:44
You can only cancel emails that are still scheduled. Emails that have already been sent cannot be canceled.

Common Use Cases

Scheduling with Templates

You can schedule template-based emails:

Scheduling Batch Emails

Schedule multiple emails at once using batch send:
Batch scheduling is useful for sending newsletters or announcements to multiple recipients at a specific time.

Error Handling

Handle errors when scheduling, updating, or canceling emails:

Best Practices

1

Use UTC for Scheduling

Always convert to UTC when scheduling to avoid timezone issues:
2

Store Email IDs

Save scheduled email IDs to enable updates or cancellations:
3

Add Scheduling Buffer

Schedule emails with a buffer to account for processing time:
4

Tag Scheduled Emails

Use tags to identify and track scheduled campaigns:
5

Handle Timezone Conversions

When working with user timezones, convert properly:
6

Implement Cancellation Logic

Build logic to cancel scheduled emails when events change:

Time Format Reference

The SDK expects ISO 8601 format (RFC3339). Here are common formatting examples:
Always use time.RFC3339 or a compatible ISO 8601 format. Other formats may be rejected by the API.

Next Steps

Sending Emails

Learn the basics of sending emails

Email Templates

Schedule template-based emails

Batch Emails

Schedule multiple emails at once

Attachments

Add attachments to scheduled emails