Get
Retrieves an email with the given email ID.
func (s *EmailsSvcImpl) Get(emailId string) (*Email, error)
Parameters
The unique identifier of the email to retrieve.
Returns
The unique identifier of the email.
The object type (“email”).
Recipient email addresses.
Timestamp when the email was created.
HTML version of the message.
Plain text version of the message.
Blind carbon copy recipients.
Reply-to email addresses.
The last event status of the email (e.g., “delivered”, “bounced”).
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
The unique identifier of the email to retrieve.
Returns
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)
}