You have access to the AgentMail email API. Your inbox is sol-ai@agentmail.to.
Your API key is in secrets/sol-agentmail-api-key.txt.
export AGENTMAIL_KEY=$(cat ~/.openclaw/workspace/secrets/sol-agentmail-api-key.txt | tr -d '\n')
export INBOX_ID="sol-ai@agentmail.to"
export API_BASE="https://api.agentmail.to/v0"
curl -s -X POST "$API_BASE/inboxes/$INBOX_ID/messages/send" \
-H "Authorization: Bearer $AGENTMAIL_KEY" \
-H "Content-Type: application/json" \
-d '{
"to": ["recipient@example.com"],
"subject": "Subject line",
"text": "Body text here."
}'
curl -s "$API_BASE/inboxes/$INBOX_ID/messages?limit=10" \
-H "Authorization: Bearer $AGENTMAIL_KEY"
curl -s "$API_BASE/inboxes/$INBOX_ID/messages/MESSAGE_ID" \
-H "Authorization: Bearer $AGENTMAIL_KEY"
Use the extracted_text field from the response — it strips quoted reply history.
Important: The
/messages/{id}/replyendpoint does NOT accept Gmail or SES message IDs directly. Use the send endpoint within_reply_toandreferencesheaders instead — this correctly threads the reply.
# Get the full message first to extract the message_id and thread_id
FULL_MSG=$(curl -s "$API_BASE/inboxes/$INBOX_ID/messages/MESSAGE_ID" \
-H "Authorization: Bearer $AGENTMAIL_KEY")
# Extract from_: the original sender's email (to find their address)
# Extract the in_reply_to and references from the message headers
curl -s -X POST "$API_BASE/inboxes/$INBOX_ID/messages/send" \
-H "Authorization: Bearer $AGENTMAIL_KEY" \
-H "Content-Type: application/json" \
-d '{
"to": ["original_sender@email.com"],
"subject": "Re: Original Subject",
"text": "Your reply text here.",
"in_reply_to": "ORIGINAL_MESSAGE_ID",
"references": ["ORIGINAL_REFERENCES"]
}'
Or more simply: just use the send endpoint with the same subject prefixed Re: and include in_reply_to: ORIGINAL_MESSAGE_ID — threading works automatically.
curl -s -X PATCH "$API_BASE/inboxes/$INBOX_ID/messages/MESSAGE_ID" \
-H "Authorization: Bearer $AGENTMAIL_KEY" \
-H "Content-Type: application/json" \
-d '{"labels": ["seen"]}'
messages/MESSAGE_ID to get full body