-
Notifications
You must be signed in to change notification settings - Fork 8
Expand file tree
/
Copy pathinboxes_api.rb
More file actions
33 lines (24 loc) · 882 Bytes
/
inboxes_api.rb
File metadata and controls
33 lines (24 loc) · 882 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
require 'mailtrap'
account_id = 3229
client = Mailtrap::Client.new(api_key: 'your-api-key')
inboxes = Mailtrap::InboxesAPI.new(account_id, client)
# Create new Inbox
inbox = inboxes.create(name: 'Test Inbox', project_id: 123_456)
# => #<struct Mailtrap::Inbox id=1, name="Test Inbox">
# Get all Inboxes
inboxes.list
# => [#<struct Mailtrap::Inbox id=1, name="Test Inbox">]
# Update inbox
inboxes.update(inbox.id, name: 'Test Inbox Updated')
# => #<struct Mailtrap::Inbox id=1, name="Test Inbox Updated">
# Get contact list
inbox = inboxes.get(inbox.id)
# => #<struct Mailtrap::Inbox id=1, name="Test Inbox Updated">
# Delete all messages (emails) from Inbox
inboxes.clean(inbox.id)
# Mark all messages in the inbox as read
inboxes.mark_as_read(inbox.id)
# Reset SMTP credentials of the inbox
inboxes.reset_credentials(inbox.id)
# Delete unbox list
inboxes.delete(inbox.id)