Skip to main content
The Receiving API allows you to access inbound emails sent to your domains. This guide covers retrieving received emails and downloading attachments with the Resend Go SDK.

Overview

The Receiving service provides:
  • Access to inbound emails sent to your verified domains
  • Full email content including HTML, text, and headers
  • Attachment management with download URLs
  • Pagination for listing large volumes of received emails
Inbound email functionality must be enabled on your Resend account. Contact Resend support to enable this feature.

Accessing the Receiving Service

The Receiving service is accessed through the Client.Emails.Receiving interface.
Initialize Client

Retrieving a Received Email

Get the full content of a specific inbound email by ID.
Get Received Email

ReceivedEmail Structure

The ReceivedEmail struct contains complete email information:
string
Unique identifier for the received email
string
Always “email” for received emails
[]string
Array of recipient email addresses
string
Sender email address
string
Email subject line
string
HTML version of the email body
string
Plain text version of the email body
[]string
Array of CC recipient email addresses
[]string
Array of BCC recipient email addresses
[]string
Array of reply-to email addresses
map[string]string
Email headers as key-value pairs
string
Message-ID header value
string
Timestamp when the email was received
[]ReceivedAttachment
Array of attachment metadata
RawEmail
Raw email download information

Listing Received Emails

Retrieve all received emails with optional pagination.
The list response uses ListReceivedEmail which omits Html, Text, and Headers fields for efficiency. Use Get() to retrieve full email content.

Working with Email Headers

Access email headers for advanced processing:
Accessing Email Headers

Managing Attachments

Received emails can include attachments. The SDK provides methods to list and retrieve attachment details including download URLs.

Listing Attachments

ReceivedAttachment Structure

string
Unique identifier for the attachment
string
Original filename of the attachment
string
MIME type of the attachment (e.g., “application/pdf”, “image/png”)
string
Content-Disposition header value (e.g., “attachment”, “inline”)
string
Content-ID for inline attachments (used in HTML emails)

Downloading Attachments

Get attachment details including temporary download URLs.
Get Attachment Details

EmailAttachment Structure

string
Unique identifier for the attachment
string
Original filename of the attachment
string
MIME type of the attachment
string
Content-Disposition header value
string
Content-ID for inline attachments
string
Temporary pre-signed URL for downloading the attachment
string
Timestamp when the download URL expires

Downloading Attachment Files

Use the download URL to fetch attachment content:
Download Attachment
Download URLs are temporary and expire after a set period. Always download attachments promptly or store the URLs for short-term use only.

Complete Example

Here’s a complete example demonstrating received email processing:
Complete Receiving Workflow

Processing Patterns

Auto-Response System

Auto-Responder

Support Ticket Creation

Ticket System Integration

Best Practices

Use Pagination

Always use pagination when listing large volumes of received emails to avoid memory issues.

Download Attachments Promptly

Attachment download URLs expire. Download and store attachments as soon as possible.

Track Processed Emails

Maintain a record of processed email IDs to avoid duplicate processing.

Handle Errors Gracefully

Implement robust error handling for network issues and missing emails.

Parse Headers Carefully

Check for header existence before accessing to avoid nil pointer errors.

Use Context Timeouts

Set appropriate timeouts when processing emails to prevent hanging operations.

Next Steps

Webhooks

Set up webhooks to receive notifications of inbound emails

Sending Emails

Learn how to send emails with attachments

Receiving Example

View the complete receiving emails example

API Reference

View the complete Receiving API reference