Module: Mailblastr::Emails::Receiving

Defined in:
lib/mailblastr/emails.rb

Overview

Inbound (received) email.

Class Method Summary collapse

Class Method Details

.delete(email_id) ⇒ Object

Delete a received email. DELETE /emails/receiving/:id



98
99
100
# File 'lib/mailblastr/emails.rb', line 98

def delete(email_id)
  Client.request(:delete, "/emails/receiving/#{Client.path_escape(email_id)}")
end

.forward(email_id, params) ⇒ Object

Forward a received email. POST /emails/receiving/:id/forward Receiving.forward(id, { from: "you@yourdomain.com", to: "team@you.com" })



87
88
89
# File 'lib/mailblastr/emails.rb', line 87

def forward(email_id, params)
  Client.request(:post, "/emails/receiving/#{Client.path_escape(email_id)}/forward", body: params)
end

.get(email_id) ⇒ Object

Retrieve a received email. GET /emails/receiving/:id



60
61
62
# File 'lib/mailblastr/emails.rb', line 60

def get(email_id)
  Client.request(:get, "/emails/receiving/#{Client.path_escape(email_id)}")
end

.get_attachment(email_id, attachment_id) ⇒ Object

Download one attachment as raw bytes (binary String). GET /emails/receiving/:id/attachments/:attachment_id



71
72
73
74
75
76
77
# File 'lib/mailblastr/emails.rb', line 71

def get_attachment(email_id, attachment_id)
  Client.request(
    :get,
    "/emails/receiving/#{Client.path_escape(email_id)}/attachments/#{Client.path_escape(attachment_id)}",
    raw: true
  )
end

.list(params = {}) ⇒ Object

List received emails. GET /emails/receiving



55
56
57
# File 'lib/mailblastr/emails.rb', line 55

def list(params = {})
  Client.request(:get, "/emails/receiving", query: Client.pagination(params))
end

.list_attachments(email_id) ⇒ Object

List a received email's attachments. GET /emails/receiving/:id/attachments



65
66
67
# File 'lib/mailblastr/emails.rb', line 65

def list_attachments(email_id)
  Client.request(:get, "/emails/receiving/#{Client.path_escape(email_id)}/attachments")
end

.raw(email_id) ⇒ Object

Download the original RFC822/MIME message as raw bytes (binary String). GET /emails/receiving/:id/raw



81
82
83
# File 'lib/mailblastr/emails.rb', line 81

def raw(email_id)
  Client.request(:get, "/emails/receiving/#{Client.path_escape(email_id)}/raw", raw: true)
end

.reply(email_id, params) ⇒ Object

Reply to a received email's sender, threaded into the conversation. POST /emails/receiving/:id/reply



93
94
95
# File 'lib/mailblastr/emails.rb', line 93

def reply(email_id, params)
  Client.request(:post, "/emails/receiving/#{Client.path_escape(email_id)}/reply", body: params)
end