-
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
c5f07c8
commit 327079e
Showing
2 changed files
with
49 additions
and
3 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 @@ | ||
.env |
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 |
---|---|---|
@@ -1,10 +1,55 @@ | ||
#!/usr/bin/env bash | ||
set -e | ||
error_handling() { | ||
echo "ERROR occurred" | ||
exit 1 | ||
} | ||
|
||
trap 'error_handling' ERR | ||
inboxId=$(curl -sXPOST "https://api.mailslurp.com/inboxes?inboxType=SMTP_INBOX" -H"x-api-key:$API_KEY" | jq -r '.id') | ||
#<gen>curl_get_imap_inbox_access_env | ||
# download access details for an inbox as .env file and source | ||
curl -o .env -sXGET "https://api.mailslurp.com/inboxes/imap-smtp-access/env?inboxId=$inboxId" -H"x-api-key:$API_KEY" | ||
# source the .env and connect using variables | ||
source .env && curl -u "$IMAP_USERNAME:$IMAP_PASSWORD" \ | ||
"imap://$IMAP_SERVER_HOST:$IMAP_SERVER_PORT/$IMAP_MAILBOX" -X "SEARCH UNSEEN" | ||
#</gen> | ||
# assert .env contains IMAP_USERNAME=... | ||
grep IMAP_USERNAME .env | ||
#<gen>curl_get_imap_smtp | ||
# get imap and smtp access details for your account | ||
curl -XGET "https://api.mailslurp.com/inboxes/imap-smtp-access" -Hx-api-key:$API_KEY | ||
curl -sXGET "https://api.mailslurp.com/inboxes/imap-smtp-access" -H"x-api-key:$API_KEY" | ||
#</gen> | ||
#<gen>curl_get_imap_username | ||
# get username etc | ||
curl -XGET "https://api.mailslurp.com/inboxes/imap-smtp-access" \ | ||
-Hx-api-key:$API_KEY | jq -j '.imapUsername' | ||
curl -sXGET "https://api.mailslurp.com/inboxes/imap-smtp-access" \ | ||
-H"x-api-key:$API_KEY" | jq -j '.imapUsername' | ||
#</gen> | ||
#<gen>curl_get_smtp | ||
# get imap and smtp access details for your account | ||
curl -sXGET "https://api.mailslurp.com/inboxes/smtp-access" -H"x-api-key:$API_KEY" | ||
#</gen> | ||
#<gen>curl_get_smtp_username | ||
curl -sXGET "https://api.mailslurp.com/inboxes/smtp-access" \ | ||
-H"x-api-key:$API_KEY" | jq -j '.smtpUsername' | ||
#</gen> | ||
#<gen>curl_get_smtp_password | ||
curl -sXGET "https://api.mailslurp.com/inboxes/smtp-access" \ | ||
-H"x-api-key:$API_KEY" | jq -j '.smtpPassword' | ||
#</gen> | ||
#<gen>curl_get_imap | ||
# get imap access details for your account | ||
curl -sXGET "https://api.mailslurp.com/inboxes/imap-access" -H"x-api-key:$API_KEY" | ||
#</gen> | ||
#<gen>curl_get_imap_inbox_access | ||
# get imap access for specific inbox | ||
curl -sXGET "https://api.mailslurp.com/inboxes/imap-access?inboxId=$inboxId" -H"x-api-key:$API_KEY" | ||
#</gen> | ||
#<gen>curl_get_imap_username | ||
curl -sXGET "https://api.mailslurp.com/inboxes/imap-access" \ | ||
-H"x-api-key:$API_KEY" | jq -j '.imapUsername' | ||
#</gen> | ||
#<gen>curl_get_imap_password | ||
curl -sXGET "https://api.mailslurp.com/inboxes/imap-access" \ | ||
-H"x-api-key:$API_KEY" | jq -j '.imapPassword' | ||
#</gen> |