Receiving email
Inspecting messages
Read text, HTML, links and attachments after a matching email arrives.
For the Bash commands below, continue in the same terminal after the Bash / curl tab of the first-email quickstart. Its run ID, inbox and matched message variables are used below.
Read the matched message body
Run after a match in the same terminal. The key remains in your environment.
if [ -n "$MESSAGE_ID" ]; then
curl --fail-with-body --silent --show-error "$INBOXSPEC_API_URL/v1/messages/$MESSAGE_ID/body?format=text" \
-H "Authorization: Bearer $INBOXSPEC_API_KEY"
else
printf '%s\n' 'A matched message is required; inspect the wait outcome.' >&2
false
fiIf the InboxSpec CLI is already installed, it uses the same API address and key environment variables:
if [ -n "$MESSAGE_ID" ]; then
inboxspec messages body "$MESSAGE_ID" --format text
else
printf '%s\n' 'A matched message is required; inspect the wait outcome.' >&2
false
fiA message without a text part returns unsupported_format; use a format listed in that error. The API reference also covers HTML, links and attachments.