Module: Resend::Emails::Receiving

Defined in:
lib/resend/emails/receiving.rb,
lib/resend/emails/receiving/attachments.rb

Overview

Module for receiving emails API operations

Defined Under Namespace

Modules: Attachments

Class Method Summary collapse

Class Method Details

.get(email_id = "", params = {}) ⇒ Hash

Retrieve a single received email

Examples:

Resend::Emails::Receiving.get("4ef9a417-02e9-4d39-ad75-9611e0fcc33c")

With html_format

Resend::Emails::Receiving.get("4ef9a417-02e9-4d39-ad75-9611e0fcc33c", html_format: "sanitized")

Parameters:

  • email_id (String) (defaults to: "")

    The ID of the received email

  • params (Hash) (defaults to: {})

    Optional query parameters

Options Hash (params):

  • :html_format (String)

    Format of the HTML content (e.g., “sanitized”, “raw”)

Returns:

  • (Hash)

    The received email object



20
21
22
23
24
25
26
# File 'lib/resend/emails/receiving.rb', line 20

def get(email_id = "", params = {})
  path = "emails/receiving/#{email_id}"

  path += "?html_format=#{CGI.escape(params[:html_format].to_s)}" if params[:html_format]

  Resend::Request.new(path, {}, "get").perform
end

.list(params = {}) ⇒ Hash

List received emails with optional pagination

Examples:

List all received emails

Resend::Emails::Receiving.list

List with custom limit

Resend::Emails::Receiving.list(limit: 50)

List with pagination

Resend::Emails::Receiving.list(limit: 20, after: "email_id_123")

Parameters:

  • params (Hash) (defaults to: {})

    Optional parameters for pagination

Options Hash (params):

  • :limit (Integer)

    Maximum number of emails to return (1-100)

  • :after (String)

    Cursor for pagination (newer emails)

  • :before (String)

    Cursor for pagination (older emails)

Returns:

  • (Hash)

    List of received emails with pagination info



44
45
46
47
# File 'lib/resend/emails/receiving.rb', line 44

def list(params = {})
  path = Resend::PaginationHelper.build_paginated_path("emails/receiving", params)
  Resend::Request.new(path, {}, "get").perform
end