Update
Updates a scheduled email with the given parameters.Parameters
The update parameters.
Returns
Example
UpdateWithContext
Updates a scheduled email with the given parameters and context.Parameters
Context for the request.
Learn more about Mintlify
Enter your email to receive updates about new features and product releases.
Update a scheduled email using the Resend Go SDK
func (s *EmailsSvcImpl) Update(params *UpdateEmailRequest) (*UpdateEmailResponse, error)
package main
import (
"fmt"
"github.com/resend/resend-go/v3"
)
func main() {
client := resend.NewClient("re_123456789")
updateParams := &resend.UpdateEmailRequest{
Id: "4ef9a417-02e9-4d39-ad75-9611e0fcc33c",
ScheduledAt: "2024-11-05T11:52:01.858Z",
}
updated, err := client.Emails.Update(updateParams)
if err != nil {
panic(err)
}
fmt.Printf("Updated email: %s\n", updated.Id)
}
func (s *EmailsSvcImpl) UpdateWithContext(ctx context.Context, params *UpdateEmailRequest) (*UpdateEmailResponse, error)
package main
import (
"context"
"fmt"
"github.com/resend/resend-go/v3"
)
func main() {
ctx := context.Background()
client := resend.NewClient("re_123456789")
// First, schedule an email
sendParams := &resend.SendEmailRequest{
From: "[email protected]",
To: []string{"[email protected]"},
Subject: "Scheduled Email",
Text: "This email will be sent later",
ScheduledAt: "2024-09-05T11:52:01.858Z",
}
sent, err := client.Emails.SendWithContext(ctx, sendParams)
if err != nil {
panic(err)
}
// Update the scheduled time
updateParams := &resend.UpdateEmailRequest{
Id: sent.Id,
ScheduledAt: "2024-11-05T11:52:01.858Z",
}
updated, err := client.Emails.UpdateWithContext(ctx, updateParams)
if err != nil {
panic(err)
}
fmt.Printf("Updated email: %s\n", updated.Id)
}