-
Notifications
You must be signed in to change notification settings - Fork 19
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
543f0fa
commit 0d8ffb7
Showing
9 changed files
with
140 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
# Bruno email examples | ||
How to send and receive email in Bruno API client. | ||
|
||
## Setup | ||
1. Open this folder using [Bruno](http://usebruno.com). | ||
2. Configure the Authentication environment {{apiKey}} variable to use your [MailSlurp API KEY](https://app.mailslurp.com). | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
meta { | ||
name: Create an inbox | ||
type: http | ||
seq: 2 | ||
} | ||
|
||
post { | ||
url: https://api.mailslurp.com/inboxes/withDefaults | ||
body: none | ||
auth: apikey | ||
} | ||
|
||
auth:apikey { | ||
key: x-api-key | ||
value: {{apiKey}} | ||
placement: header | ||
} | ||
|
||
script:post-response { | ||
const data = res.getBody(); | ||
bru.setVar('emailAddress', data.emailAddress); | ||
bru.setVar('inboxId', data.id); | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
meta { | ||
name: Get emails | ||
type: http | ||
seq: 3 | ||
} | ||
|
||
get { | ||
url: https://api.mailslurp.com/inboxes/{{inboxId}}/emails | ||
body: none | ||
auth: apikey | ||
} | ||
|
||
auth:apikey { | ||
key: x-api-key | ||
value: {{apiKey}} | ||
placement: header | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
meta { | ||
name: Read email | ||
type: http | ||
seq: 6 | ||
} | ||
|
||
get { | ||
url: https://api.mailslurp.com/emails/{{emailId}} | ||
body: none | ||
auth: apikey | ||
} | ||
|
||
auth:apikey { | ||
key: x-api-key | ||
value: {{apiKey}} | ||
placement: header | ||
} | ||
|
||
script:post-response { | ||
const data = res.getBody(); | ||
bru.setVar('emailId', data.id); | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
meta { | ||
name: Send email | ||
type: http | ||
seq: 4 | ||
} | ||
|
||
post { | ||
url: https://api.mailslurp.com/inboxes/{{inboxId}}/confirm | ||
body: json | ||
auth: apikey | ||
} | ||
|
||
auth:apikey { | ||
key: x-api-key | ||
value: {{apiKey}} | ||
placement: header | ||
} | ||
|
||
body:json { | ||
{ | ||
"to": ["{{emailAddress}}"], | ||
"subject": "Test email", | ||
"body": "Hello world" | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
meta { | ||
name: Wait for email | ||
type: http | ||
seq: 5 | ||
} | ||
|
||
get { | ||
url: https://api.mailslurp.com/waitForLatestEmail?inboxId={{inboxId}}&timeout=60000&unreadOnly=true | ||
body: none | ||
auth: apikey | ||
} | ||
|
||
params:query { | ||
inboxId: {{inboxId}} | ||
timeout: 60000 | ||
unreadOnly: true | ||
} | ||
|
||
auth:apikey { | ||
key: x-api-key | ||
value: {{apiKey}} | ||
placement: header | ||
} | ||
|
||
script:post-response { | ||
const data = res.getBody(); | ||
bru.setVar('emailId', data.id); | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
{ | ||
"version": "1", | ||
"name": "MailSlurp Examples", | ||
"type": "collection", | ||
"ignore": [ | ||
"node_modules", | ||
".git" | ||
] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
docs { | ||
This collection demonstrates how to create email accounts in Bruno then send and receive emails using API requests. | ||
} |
3 changes: 3 additions & 0 deletions
3
bruno-api-client/mailslurp-examples/environments/Authentication.bru
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
vars:secret [ | ||
apiKey | ||
] |