Skip to main content

Method

func (s *ReceivingSvcImpl) GetAttachment(emailId string, attachmentId string) (*EmailAttachment, error)
func (s *ReceivingSvcImpl) GetAttachmentWithContext(ctx context.Context, emailId string, attachmentId string) (*EmailAttachment, error)
Access via: client.Emails.Receiving.GetAttachment(emailId, attachmentId)

Parameters

emailId
string
required
The unique identifier of the received email
attachmentId
string
required
The unique identifier of the attachment

Response

Object
string
Always "email_attachment"
Id
string
The unique identifier of the attachment
Filename
string
The filename of the attachment
ContentType
string
The MIME type of the attachment
ContentDisposition
string
The content disposition header value
ContentId
string
The content ID for inline attachments
DownloadUrl
string
Temporary URL to download the attachment file
ExpiresAt
string
ISO 8601 timestamp of when the download URL expires

Example

client := resend.NewClient("re_123456789")

attachment, err := client.Emails.Receiving.GetAttachment("email_abc123", "att_xyz789")
if err != nil {
    panic(err)
}

fmt.Println("Filename:", attachment.Filename)
fmt.Println("Content Type:", attachment.ContentType)
fmt.Println("Download URL:", attachment.DownloadUrl)
fmt.Println("Expires At:", attachment.ExpiresAt)

// Download the attachment using the URL
// resp, err := http.Get(attachment.DownloadUrl)

Build docs developers (and LLMs) love