curl --request POST \
--url https://app.gtm-api.com/email/v4/api/email-messages/send \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--header 'Team-SID: <api-key>' \
--data '
{
"email_account_sid": "<string>",
"reply_to_email_message_sid": "<string>",
"forward_email_message_sid": "<string>",
"include_original_attachments": true,
"to": [
{
"email": "jsmith@example.com",
"display_name": "<string>"
}
],
"cc": [
{
"email": "jsmith@example.com"
}
],
"bcc": [
{
"email": "jsmith@example.com"
}
],
"from_email": "jsmith@example.com",
"subject": "<string>",
"body_html": "<string>",
"body_text": "<string>",
"attachments": [
{
"name": "<string>",
"content_base64": "<string>",
"email_message_sid": "<string>",
"attachment_id": "<string>"
}
],
"include_signature": true,
"scheduled_at": "<string>",
"client_reference": "<string>",
"idempotency_key": "<string>",
"confirmed_not_sent": "<string>",
"confirmed_sent": "<string>",
"override_suppression": true,
"track_opens": true,
"track_clicks": true,
"custom_headers": [
{
"name": "<string>",
"value": "<string>"
}
]
}
'import requests
url = "https://app.gtm-api.com/email/v4/api/email-messages/send"
payload = {
"email_account_sid": "<string>",
"reply_to_email_message_sid": "<string>",
"forward_email_message_sid": "<string>",
"include_original_attachments": True,
"to": [
{
"email": "jsmith@example.com",
"display_name": "<string>"
}
],
"cc": [{ "email": "jsmith@example.com" }],
"bcc": [{ "email": "jsmith@example.com" }],
"from_email": "jsmith@example.com",
"subject": "<string>",
"body_html": "<string>",
"body_text": "<string>",
"attachments": [
{
"name": "<string>",
"content_base64": "<string>",
"email_message_sid": "<string>",
"attachment_id": "<string>"
}
],
"include_signature": True,
"scheduled_at": "<string>",
"client_reference": "<string>",
"idempotency_key": "<string>",
"confirmed_not_sent": "<string>",
"confirmed_sent": "<string>",
"override_suppression": True,
"track_opens": True,
"track_clicks": True,
"custom_headers": [
{
"name": "<string>",
"value": "<string>"
}
]
}
headers = {
"Authorization": "Bearer <token>",
"Team-SID": "<api-key>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {
Authorization: 'Bearer <token>',
'Team-SID': '<api-key>',
'Content-Type': 'application/json'
},
body: JSON.stringify({
email_account_sid: '<string>',
reply_to_email_message_sid: '<string>',
forward_email_message_sid: '<string>',
include_original_attachments: true,
to: [{email: 'jsmith@example.com', display_name: '<string>'}],
cc: [{email: 'jsmith@example.com'}],
bcc: [{email: 'jsmith@example.com'}],
from_email: 'jsmith@example.com',
subject: '<string>',
body_html: '<string>',
body_text: '<string>',
attachments: [
{
name: '<string>',
content_base64: '<string>',
email_message_sid: '<string>',
attachment_id: '<string>'
}
],
include_signature: true,
scheduled_at: '<string>',
client_reference: '<string>',
idempotency_key: '<string>',
confirmed_not_sent: '<string>',
confirmed_sent: '<string>',
override_suppression: true,
track_opens: true,
track_clicks: true,
custom_headers: [{name: '<string>', value: '<string>'}]
})
};
fetch('https://app.gtm-api.com/email/v4/api/email-messages/send', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://app.gtm-api.com/email/v4/api/email-messages/send",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'email_account_sid' => '<string>',
'reply_to_email_message_sid' => '<string>',
'forward_email_message_sid' => '<string>',
'include_original_attachments' => true,
'to' => [
[
'email' => 'jsmith@example.com',
'display_name' => '<string>'
]
],
'cc' => [
[
'email' => 'jsmith@example.com'
]
],
'bcc' => [
[
'email' => 'jsmith@example.com'
]
],
'from_email' => 'jsmith@example.com',
'subject' => '<string>',
'body_html' => '<string>',
'body_text' => '<string>',
'attachments' => [
[
'name' => '<string>',
'content_base64' => '<string>',
'email_message_sid' => '<string>',
'attachment_id' => '<string>'
]
],
'include_signature' => true,
'scheduled_at' => '<string>',
'client_reference' => '<string>',
'idempotency_key' => '<string>',
'confirmed_not_sent' => '<string>',
'confirmed_sent' => '<string>',
'override_suppression' => true,
'track_opens' => true,
'track_clicks' => true,
'custom_headers' => [
[
'name' => '<string>',
'value' => '<string>'
]
]
]),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"Content-Type: application/json",
"Team-SID: <api-key>"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://app.gtm-api.com/email/v4/api/email-messages/send"
payload := strings.NewReader("{\n \"email_account_sid\": \"<string>\",\n \"reply_to_email_message_sid\": \"<string>\",\n \"forward_email_message_sid\": \"<string>\",\n \"include_original_attachments\": true,\n \"to\": [\n {\n \"email\": \"jsmith@example.com\",\n \"display_name\": \"<string>\"\n }\n ],\n \"cc\": [\n {\n \"email\": \"jsmith@example.com\"\n }\n ],\n \"bcc\": [\n {\n \"email\": \"jsmith@example.com\"\n }\n ],\n \"from_email\": \"jsmith@example.com\",\n \"subject\": \"<string>\",\n \"body_html\": \"<string>\",\n \"body_text\": \"<string>\",\n \"attachments\": [\n {\n \"name\": \"<string>\",\n \"content_base64\": \"<string>\",\n \"email_message_sid\": \"<string>\",\n \"attachment_id\": \"<string>\"\n }\n ],\n \"include_signature\": true,\n \"scheduled_at\": \"<string>\",\n \"client_reference\": \"<string>\",\n \"idempotency_key\": \"<string>\",\n \"confirmed_not_sent\": \"<string>\",\n \"confirmed_sent\": \"<string>\",\n \"override_suppression\": true,\n \"track_opens\": true,\n \"track_clicks\": true,\n \"custom_headers\": [\n {\n \"name\": \"<string>\",\n \"value\": \"<string>\"\n }\n ]\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Authorization", "Bearer <token>")
req.Header.Add("Team-SID", "<api-key>")
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://app.gtm-api.com/email/v4/api/email-messages/send")
.header("Authorization", "Bearer <token>")
.header("Team-SID", "<api-key>")
.header("Content-Type", "application/json")
.body("{\n \"email_account_sid\": \"<string>\",\n \"reply_to_email_message_sid\": \"<string>\",\n \"forward_email_message_sid\": \"<string>\",\n \"include_original_attachments\": true,\n \"to\": [\n {\n \"email\": \"jsmith@example.com\",\n \"display_name\": \"<string>\"\n }\n ],\n \"cc\": [\n {\n \"email\": \"jsmith@example.com\"\n }\n ],\n \"bcc\": [\n {\n \"email\": \"jsmith@example.com\"\n }\n ],\n \"from_email\": \"jsmith@example.com\",\n \"subject\": \"<string>\",\n \"body_html\": \"<string>\",\n \"body_text\": \"<string>\",\n \"attachments\": [\n {\n \"name\": \"<string>\",\n \"content_base64\": \"<string>\",\n \"email_message_sid\": \"<string>\",\n \"attachment_id\": \"<string>\"\n }\n ],\n \"include_signature\": true,\n \"scheduled_at\": \"<string>\",\n \"client_reference\": \"<string>\",\n \"idempotency_key\": \"<string>\",\n \"confirmed_not_sent\": \"<string>\",\n \"confirmed_sent\": \"<string>\",\n \"override_suppression\": true,\n \"track_opens\": true,\n \"track_clicks\": true,\n \"custom_headers\": [\n {\n \"name\": \"<string>\",\n \"value\": \"<string>\"\n }\n ]\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://app.gtm-api.com/email/v4/api/email-messages/send")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <token>'
request["Team-SID"] = '<api-key>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"email_account_sid\": \"<string>\",\n \"reply_to_email_message_sid\": \"<string>\",\n \"forward_email_message_sid\": \"<string>\",\n \"include_original_attachments\": true,\n \"to\": [\n {\n \"email\": \"jsmith@example.com\",\n \"display_name\": \"<string>\"\n }\n ],\n \"cc\": [\n {\n \"email\": \"jsmith@example.com\"\n }\n ],\n \"bcc\": [\n {\n \"email\": \"jsmith@example.com\"\n }\n ],\n \"from_email\": \"jsmith@example.com\",\n \"subject\": \"<string>\",\n \"body_html\": \"<string>\",\n \"body_text\": \"<string>\",\n \"attachments\": [\n {\n \"name\": \"<string>\",\n \"content_base64\": \"<string>\",\n \"email_message_sid\": \"<string>\",\n \"attachment_id\": \"<string>\"\n }\n ],\n \"include_signature\": true,\n \"scheduled_at\": \"<string>\",\n \"client_reference\": \"<string>\",\n \"idempotency_key\": \"<string>\",\n \"confirmed_not_sent\": \"<string>\",\n \"confirmed_sent\": \"<string>\",\n \"override_suppression\": true,\n \"track_opens\": true,\n \"track_clicks\": true,\n \"custom_headers\": [\n {\n \"name\": \"<string>\",\n \"value\": \"<string>\"\n }\n ]\n}"
response = http.request(request)
puts response.read_body{
"success": true,
"operation": "action",
"action": "<string>",
"item": {
"sid": "<string>",
"team_sid": "<string>",
"email_account_sid": "<string>",
"email_thread_sid": "<string>",
"internet_message_id": "<string>",
"provider_message_id": "<string>",
"direction": "inbound",
"status": "received",
"kind": "regular",
"in_reply_to_email_message_sid": "<string>",
"bounce_type": "hard",
"bounce_code": "<string>",
"bounce_diagnostic": "<string>",
"from": {
"email": "<string>",
"display_name": "<string>"
},
"to": [
{
"email": "<string>",
"display_name": "<string>"
}
],
"cc": [
{
"email": "<string>",
"display_name": "<string>"
}
],
"bcc": [
{
"email": "<string>",
"display_name": "<string>"
}
],
"reply_to": [
{
"email": "<string>",
"display_name": "<string>"
}
],
"subject": "<string>",
"snippet": "<string>",
"is_body_synced": true,
"attachments": [
{
"id": "<string>",
"name": "<string>",
"mime": "<string>",
"size": 1,
"content_id": "<string>",
"is_inline": true
}
],
"has_attachments": true,
"email_folder_sids": [
"<string>"
],
"folder_role": "inbox",
"is_read": true,
"client_reference": "<string>",
"first_opened_at": "<string>",
"opens_count": 123,
"first_clicked_at": "<string>",
"clicks_count": 123,
"unsubscribed_at": "<string>",
"sent_at": "<string>",
"scheduled_at": "<string>",
"created_by": {
"actor_type": "user",
"actor_sid": "<string>",
"team_sid": "<string>",
"permissions": {},
"actor_name": "<string>",
"oauth_client_sid": "<string>",
"reason": "<string>",
"cluster_id": 123,
"trace_id": "<string>"
},
"body_html": "<string>",
"body_text": "<string>",
"headers": [
{
"name": "<string>",
"value": "<string>"
}
],
"body_html_sanitized": "<string>",
"body_text_unquoted": "<string>",
"created_at": "<string>",
"updated_at": "<string>",
"is_flagged": true,
"is_answered": true,
"deleted_at": "<string>"
},
"result": {
"activity_log": {
"sid": "<string>",
"team_sid": "<string>",
"email_account_sid": "<string>",
"email_message_sid": "<string>",
"email_account_sync_run_sid": "<string>",
"trace_id": "<string>",
"action_type": "connect_probe",
"status": "pending",
"target_address": "<string>",
"actor": {
"actor_type": "user",
"actor_sid": "<string>",
"team_sid": "<string>",
"permissions": {},
"actor_name": "<string>",
"oauth_client_sid": "<string>",
"reason": "<string>",
"cluster_id": 123,
"trace_id": "<string>"
},
"reason": "<string>",
"error_code": "<string>",
"error_message": "<string>",
"duration_ms": 123,
"created_at": "<string>",
"updated_at": "<string>",
"deleted_at": "<string>"
},
"suppressed_recipients": [
"<string>"
],
"idempotent_replay": true,
"content_differs": true
},
"meta": {
"trace_id": "<string>",
"span_id": "<string>",
"timestamp": "<string>",
"duration_ms": 1,
"team_sid": "<string>",
"actor_type": "<string>"
},
"async": true,
"pending": [
{
"activity_log": {
"sid": "<string>",
"team_sid": "<string>",
"email_account_sid": "<string>",
"email_message_sid": "<string>",
"email_account_sync_run_sid": "<string>",
"trace_id": "<string>",
"action_type": "connect_probe",
"status": "pending",
"target_address": "<string>",
"actor": {
"actor_type": "user",
"actor_sid": "<string>",
"team_sid": "<string>",
"permissions": {},
"actor_name": "<string>",
"oauth_client_sid": "<string>",
"reason": "<string>",
"cluster_id": 123,
"trace_id": "<string>"
},
"reason": "<string>",
"error_code": "<string>",
"error_message": "<string>",
"duration_ms": 123,
"created_at": "<string>",
"updated_at": "<string>",
"deleted_at": "<string>"
},
"expected_completion_seconds": 123,
"webhook_events": [
"<string>"
],
"polling_hint": "<string>"
}
]
}Send email message
Send an email from a connected mailbox: a new message (to, subject and one of body_html or body_text), a reply (reply_to_email_message_sid: subject, threading and the recipient come from the original) or a forward (forward_email_message_sid). Without scheduled_at it goes out now and item is the sent message; a refusal is a 409 whose context.reason and context.send_outcome say what happened. With scheduled_at it is queued (async true) and leaves under the mailbox’s daily limit, window and warmup. Recipients on the stop-list are left out and listed in result.suppressed_recipients; all of them stopped is 409 recipient_suppressed. Always pass client_reference: a repeat under the same key and recipients is answered by the first send, never sent twice. On a timeout or 409 send_outcome_unknown do not send again: ask check_email_message_sent. Requires can_act_email_messages.
Contract:
- MCP tool
send_email_message, registry packagemcp.email/email_messages, mountemail.messaging. - Operation
action, response envelopeaction. - Flags: dangerous: the MCP layer gates it behind a preview/commit token, and the effect cannot be undone through this API; step eligible: gtm.service.orchestration can run this verb as a mass-action plan step, once per item; schedule required: bulk use of this verb MUST be paced, an unpaced plan is rejected.
curl --request POST \
--url https://app.gtm-api.com/email/v4/api/email-messages/send \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--header 'Team-SID: <api-key>' \
--data '
{
"email_account_sid": "<string>",
"reply_to_email_message_sid": "<string>",
"forward_email_message_sid": "<string>",
"include_original_attachments": true,
"to": [
{
"email": "jsmith@example.com",
"display_name": "<string>"
}
],
"cc": [
{
"email": "jsmith@example.com"
}
],
"bcc": [
{
"email": "jsmith@example.com"
}
],
"from_email": "jsmith@example.com",
"subject": "<string>",
"body_html": "<string>",
"body_text": "<string>",
"attachments": [
{
"name": "<string>",
"content_base64": "<string>",
"email_message_sid": "<string>",
"attachment_id": "<string>"
}
],
"include_signature": true,
"scheduled_at": "<string>",
"client_reference": "<string>",
"idempotency_key": "<string>",
"confirmed_not_sent": "<string>",
"confirmed_sent": "<string>",
"override_suppression": true,
"track_opens": true,
"track_clicks": true,
"custom_headers": [
{
"name": "<string>",
"value": "<string>"
}
]
}
'import requests
url = "https://app.gtm-api.com/email/v4/api/email-messages/send"
payload = {
"email_account_sid": "<string>",
"reply_to_email_message_sid": "<string>",
"forward_email_message_sid": "<string>",
"include_original_attachments": True,
"to": [
{
"email": "jsmith@example.com",
"display_name": "<string>"
}
],
"cc": [{ "email": "jsmith@example.com" }],
"bcc": [{ "email": "jsmith@example.com" }],
"from_email": "jsmith@example.com",
"subject": "<string>",
"body_html": "<string>",
"body_text": "<string>",
"attachments": [
{
"name": "<string>",
"content_base64": "<string>",
"email_message_sid": "<string>",
"attachment_id": "<string>"
}
],
"include_signature": True,
"scheduled_at": "<string>",
"client_reference": "<string>",
"idempotency_key": "<string>",
"confirmed_not_sent": "<string>",
"confirmed_sent": "<string>",
"override_suppression": True,
"track_opens": True,
"track_clicks": True,
"custom_headers": [
{
"name": "<string>",
"value": "<string>"
}
]
}
headers = {
"Authorization": "Bearer <token>",
"Team-SID": "<api-key>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {
Authorization: 'Bearer <token>',
'Team-SID': '<api-key>',
'Content-Type': 'application/json'
},
body: JSON.stringify({
email_account_sid: '<string>',
reply_to_email_message_sid: '<string>',
forward_email_message_sid: '<string>',
include_original_attachments: true,
to: [{email: 'jsmith@example.com', display_name: '<string>'}],
cc: [{email: 'jsmith@example.com'}],
bcc: [{email: 'jsmith@example.com'}],
from_email: 'jsmith@example.com',
subject: '<string>',
body_html: '<string>',
body_text: '<string>',
attachments: [
{
name: '<string>',
content_base64: '<string>',
email_message_sid: '<string>',
attachment_id: '<string>'
}
],
include_signature: true,
scheduled_at: '<string>',
client_reference: '<string>',
idempotency_key: '<string>',
confirmed_not_sent: '<string>',
confirmed_sent: '<string>',
override_suppression: true,
track_opens: true,
track_clicks: true,
custom_headers: [{name: '<string>', value: '<string>'}]
})
};
fetch('https://app.gtm-api.com/email/v4/api/email-messages/send', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://app.gtm-api.com/email/v4/api/email-messages/send",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'email_account_sid' => '<string>',
'reply_to_email_message_sid' => '<string>',
'forward_email_message_sid' => '<string>',
'include_original_attachments' => true,
'to' => [
[
'email' => 'jsmith@example.com',
'display_name' => '<string>'
]
],
'cc' => [
[
'email' => 'jsmith@example.com'
]
],
'bcc' => [
[
'email' => 'jsmith@example.com'
]
],
'from_email' => 'jsmith@example.com',
'subject' => '<string>',
'body_html' => '<string>',
'body_text' => '<string>',
'attachments' => [
[
'name' => '<string>',
'content_base64' => '<string>',
'email_message_sid' => '<string>',
'attachment_id' => '<string>'
]
],
'include_signature' => true,
'scheduled_at' => '<string>',
'client_reference' => '<string>',
'idempotency_key' => '<string>',
'confirmed_not_sent' => '<string>',
'confirmed_sent' => '<string>',
'override_suppression' => true,
'track_opens' => true,
'track_clicks' => true,
'custom_headers' => [
[
'name' => '<string>',
'value' => '<string>'
]
]
]),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"Content-Type: application/json",
"Team-SID: <api-key>"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://app.gtm-api.com/email/v4/api/email-messages/send"
payload := strings.NewReader("{\n \"email_account_sid\": \"<string>\",\n \"reply_to_email_message_sid\": \"<string>\",\n \"forward_email_message_sid\": \"<string>\",\n \"include_original_attachments\": true,\n \"to\": [\n {\n \"email\": \"jsmith@example.com\",\n \"display_name\": \"<string>\"\n }\n ],\n \"cc\": [\n {\n \"email\": \"jsmith@example.com\"\n }\n ],\n \"bcc\": [\n {\n \"email\": \"jsmith@example.com\"\n }\n ],\n \"from_email\": \"jsmith@example.com\",\n \"subject\": \"<string>\",\n \"body_html\": \"<string>\",\n \"body_text\": \"<string>\",\n \"attachments\": [\n {\n \"name\": \"<string>\",\n \"content_base64\": \"<string>\",\n \"email_message_sid\": \"<string>\",\n \"attachment_id\": \"<string>\"\n }\n ],\n \"include_signature\": true,\n \"scheduled_at\": \"<string>\",\n \"client_reference\": \"<string>\",\n \"idempotency_key\": \"<string>\",\n \"confirmed_not_sent\": \"<string>\",\n \"confirmed_sent\": \"<string>\",\n \"override_suppression\": true,\n \"track_opens\": true,\n \"track_clicks\": true,\n \"custom_headers\": [\n {\n \"name\": \"<string>\",\n \"value\": \"<string>\"\n }\n ]\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Authorization", "Bearer <token>")
req.Header.Add("Team-SID", "<api-key>")
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://app.gtm-api.com/email/v4/api/email-messages/send")
.header("Authorization", "Bearer <token>")
.header("Team-SID", "<api-key>")
.header("Content-Type", "application/json")
.body("{\n \"email_account_sid\": \"<string>\",\n \"reply_to_email_message_sid\": \"<string>\",\n \"forward_email_message_sid\": \"<string>\",\n \"include_original_attachments\": true,\n \"to\": [\n {\n \"email\": \"jsmith@example.com\",\n \"display_name\": \"<string>\"\n }\n ],\n \"cc\": [\n {\n \"email\": \"jsmith@example.com\"\n }\n ],\n \"bcc\": [\n {\n \"email\": \"jsmith@example.com\"\n }\n ],\n \"from_email\": \"jsmith@example.com\",\n \"subject\": \"<string>\",\n \"body_html\": \"<string>\",\n \"body_text\": \"<string>\",\n \"attachments\": [\n {\n \"name\": \"<string>\",\n \"content_base64\": \"<string>\",\n \"email_message_sid\": \"<string>\",\n \"attachment_id\": \"<string>\"\n }\n ],\n \"include_signature\": true,\n \"scheduled_at\": \"<string>\",\n \"client_reference\": \"<string>\",\n \"idempotency_key\": \"<string>\",\n \"confirmed_not_sent\": \"<string>\",\n \"confirmed_sent\": \"<string>\",\n \"override_suppression\": true,\n \"track_opens\": true,\n \"track_clicks\": true,\n \"custom_headers\": [\n {\n \"name\": \"<string>\",\n \"value\": \"<string>\"\n }\n ]\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://app.gtm-api.com/email/v4/api/email-messages/send")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <token>'
request["Team-SID"] = '<api-key>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"email_account_sid\": \"<string>\",\n \"reply_to_email_message_sid\": \"<string>\",\n \"forward_email_message_sid\": \"<string>\",\n \"include_original_attachments\": true,\n \"to\": [\n {\n \"email\": \"jsmith@example.com\",\n \"display_name\": \"<string>\"\n }\n ],\n \"cc\": [\n {\n \"email\": \"jsmith@example.com\"\n }\n ],\n \"bcc\": [\n {\n \"email\": \"jsmith@example.com\"\n }\n ],\n \"from_email\": \"jsmith@example.com\",\n \"subject\": \"<string>\",\n \"body_html\": \"<string>\",\n \"body_text\": \"<string>\",\n \"attachments\": [\n {\n \"name\": \"<string>\",\n \"content_base64\": \"<string>\",\n \"email_message_sid\": \"<string>\",\n \"attachment_id\": \"<string>\"\n }\n ],\n \"include_signature\": true,\n \"scheduled_at\": \"<string>\",\n \"client_reference\": \"<string>\",\n \"idempotency_key\": \"<string>\",\n \"confirmed_not_sent\": \"<string>\",\n \"confirmed_sent\": \"<string>\",\n \"override_suppression\": true,\n \"track_opens\": true,\n \"track_clicks\": true,\n \"custom_headers\": [\n {\n \"name\": \"<string>\",\n \"value\": \"<string>\"\n }\n ]\n}"
response = http.request(request)
puts response.read_body{
"success": true,
"operation": "action",
"action": "<string>",
"item": {
"sid": "<string>",
"team_sid": "<string>",
"email_account_sid": "<string>",
"email_thread_sid": "<string>",
"internet_message_id": "<string>",
"provider_message_id": "<string>",
"direction": "inbound",
"status": "received",
"kind": "regular",
"in_reply_to_email_message_sid": "<string>",
"bounce_type": "hard",
"bounce_code": "<string>",
"bounce_diagnostic": "<string>",
"from": {
"email": "<string>",
"display_name": "<string>"
},
"to": [
{
"email": "<string>",
"display_name": "<string>"
}
],
"cc": [
{
"email": "<string>",
"display_name": "<string>"
}
],
"bcc": [
{
"email": "<string>",
"display_name": "<string>"
}
],
"reply_to": [
{
"email": "<string>",
"display_name": "<string>"
}
],
"subject": "<string>",
"snippet": "<string>",
"is_body_synced": true,
"attachments": [
{
"id": "<string>",
"name": "<string>",
"mime": "<string>",
"size": 1,
"content_id": "<string>",
"is_inline": true
}
],
"has_attachments": true,
"email_folder_sids": [
"<string>"
],
"folder_role": "inbox",
"is_read": true,
"client_reference": "<string>",
"first_opened_at": "<string>",
"opens_count": 123,
"first_clicked_at": "<string>",
"clicks_count": 123,
"unsubscribed_at": "<string>",
"sent_at": "<string>",
"scheduled_at": "<string>",
"created_by": {
"actor_type": "user",
"actor_sid": "<string>",
"team_sid": "<string>",
"permissions": {},
"actor_name": "<string>",
"oauth_client_sid": "<string>",
"reason": "<string>",
"cluster_id": 123,
"trace_id": "<string>"
},
"body_html": "<string>",
"body_text": "<string>",
"headers": [
{
"name": "<string>",
"value": "<string>"
}
],
"body_html_sanitized": "<string>",
"body_text_unquoted": "<string>",
"created_at": "<string>",
"updated_at": "<string>",
"is_flagged": true,
"is_answered": true,
"deleted_at": "<string>"
},
"result": {
"activity_log": {
"sid": "<string>",
"team_sid": "<string>",
"email_account_sid": "<string>",
"email_message_sid": "<string>",
"email_account_sync_run_sid": "<string>",
"trace_id": "<string>",
"action_type": "connect_probe",
"status": "pending",
"target_address": "<string>",
"actor": {
"actor_type": "user",
"actor_sid": "<string>",
"team_sid": "<string>",
"permissions": {},
"actor_name": "<string>",
"oauth_client_sid": "<string>",
"reason": "<string>",
"cluster_id": 123,
"trace_id": "<string>"
},
"reason": "<string>",
"error_code": "<string>",
"error_message": "<string>",
"duration_ms": 123,
"created_at": "<string>",
"updated_at": "<string>",
"deleted_at": "<string>"
},
"suppressed_recipients": [
"<string>"
],
"idempotent_replay": true,
"content_differs": true
},
"meta": {
"trace_id": "<string>",
"span_id": "<string>",
"timestamp": "<string>",
"duration_ms": 1,
"team_sid": "<string>",
"actor_type": "<string>"
},
"async": true,
"pending": [
{
"activity_log": {
"sid": "<string>",
"team_sid": "<string>",
"email_account_sid": "<string>",
"email_message_sid": "<string>",
"email_account_sync_run_sid": "<string>",
"trace_id": "<string>",
"action_type": "connect_probe",
"status": "pending",
"target_address": "<string>",
"actor": {
"actor_type": "user",
"actor_sid": "<string>",
"team_sid": "<string>",
"permissions": {},
"actor_name": "<string>",
"oauth_client_sid": "<string>",
"reason": "<string>",
"cluster_id": 123,
"trace_id": "<string>"
},
"reason": "<string>",
"error_code": "<string>",
"error_message": "<string>",
"duration_ms": 123,
"created_at": "<string>",
"updated_at": "<string>",
"deleted_at": "<string>"
},
"expected_completion_seconds": 123,
"webhook_events": [
"<string>"
],
"polling_hint": "<string>"
}
]
}Authorizations
Headers
Body
Request body of send_email_message.
Response
action success envelope.