---
updatedAt: 2026-04-23T12:53:11.000Z
agentTools:
  projectIndex: https://developers.themarketer.com/llms.txt
---

# Send Email

If you want to send your transactional emails through theMarketer (for example order confirmations, invoice emails etc.), you can do so by using our Transactional Emails API. Keep in mind that this service is billed separately from your theMarketer subscription.

By default, the Transactional Emails functionality is in Sanbox mode, which means that emails can only be sent out to email addresses which are defined in the sandbox recipients list.

**When you plan to go live, please ensure that you have added transactional emails credit to your account, and that you have used the Go Live button in the interface.**

As an alternative to the API, you can also use SMTP. Sample call example with PHPMailer:

```php
<?php

require "vendor/autoload.php";
use PHPMailer\PHPMailer\PHPMailer;

$smtpEndpoint = "smtp1.themarketer.com";
$apiKey = "MyAPI_REST_Key";
$customerId = “Customer_Id_from_theMarketer”;
$smtpPort = "2525"; //or 42525, depending on your server configuration

$mail = new PHPMailer;
$mail->isSMTP();

$mail->Host = $smtpEndpoint;
$mail->Port = $smtpPort;
$mail->SMTPAuth = true;
$mail->Username = $apiKey;
$mail->Password = $customerId;
$mail->addAddress("recipient@domain.tld", "Receiver Name");
$mail->Subject = "Your email subject line";
$mail->msgHTML(file_get_contents("message.html"), __DIR__);
$mail->Body = "This is just a plain text message body";
$mail->addAttachment("attachment.extension");


if (!$mail->send()) {
    echo "Mailer Error: " . $mail->ErrorInfo;
} else {
    echo "The email message was sent.";
}
?>
```

<br />

<br />

# OpenAPI definition

```json
{
  "openapi": "3.0.0",
  "info": {
    "title": "theMarketer API",
    "version": "1.0.0",
    "description": ""
  },
  "servers": [
    {
      "url": "https://t.themarketer.com"
    }
  ],
  "paths": {
    "/api/v1/transactional/send-email": {
      "parameters": [],
      "post": {
        "summary": "Send Email",
        "tags": [],
        "parameters": [
          {
            "name": "k",
            "in": "query",
            "required": true,
            "deprecated": false,
            "schema": {
              "type": "string"
            },
            "example": "REST_KEY"
          },
          {
            "name": "u",
            "in": "query",
            "required": true,
            "deprecated": false,
            "schema": {
              "type": "string"
            },
            "example": "CUSTOMER_ID"
          }
        ],
        "responses": {
          "200": {
            "description": "200 Success",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "result": {
                      "type": "string",
                      "example": "success",
                      "description": "success"
                    },
                    "message_id": {
                      "type": "string",
                      "example": "688335750b110a40fa09bcbc",
                      "description": "688335750b110a40fa09bcbc"
                    }
                  }
                },
                "example": {
                  "result": "success",
                  "message_id": "688335750b110a40fa09bcbc"
                }
              }
            }
          },
          "404": {
            "description": "404 Not found",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "message": {
                      "type": "string",
                      "example": "No query results for model [App\\Models\\System\\Domain] CUSTOMER_ID",
                      "description": "No query results for model [App\\Models\\System\\Domain] CUSTOMER_ID"
                    }
                  }
                },
                "example": {
                  "message": "No query results for model [App\\Models\\System\\Domain] CUSTOMER_ID"
                }
              }
            }
          },
          "405": {
            "description": "405 Method not allowed",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "message": {
                      "type": "string",
                      "example": "The GET method is not supported for this route. Supported methods: POST",
                      "description": "The GET method is not supported for this route. Supported methods: POST"
                    }
                  }
                },
                "example": {
                  "message": "Method not suported"
                }
              }
            }
          },
          "422": {
            "description": "422 Unprocessable content",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "message": {
                      "type": "string",
                      "example": "The to must be a valid email address.",
                      "description": "The to must be a valid email address."
                    },
                    "errors": {
                      "type": "object",
                      "properties": {
                        "to": {
                          "type": "array",
                          "items": {
                            "type": "string",
                            "example": "The to must be a valid email address.",
                            "description": "The to must be a valid email address."
                          }
                        },
                        "no_credit": {
                          "type": "array",
                          "items": {
                            "type": "string",
                            "example": "You have no credit left. Please top up your account.",
                            "description": "You have no credit left. Please top up your account."
                          }
                        },
                        "sandbox_enabled": {
                          "type": "array",
                          "items": {
                            "type": "string",
                            "example": "Sandbox mode enabled. Recipient email must be in the sandbox recipients list.",
                            "description": "Sandbox mode enabled. Recipient email must be in the sandbox recipients list."
                          }
                        },
                        "from": {
                          "type": "array",
                          "items": {
                            "type": "string",
                            "example": "Sender email address is not validated in your account.",
                            "description": "Sender email address is not validated in your account."
                          }
                        }
                      }
                    }
                  }
                },
                "example": {
                  "message": "The to must be a valid email address.",
                  "errors": {
                    "to": [
                      "The to must be a valid email address."
                    ]
                  }
                }
              }
            }
          }
        },
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "to": {
                    "type": "string",
                    "format": "email",
                    "description": "email@example.com"
                  },
                  "subject": {
                    "type": "string",
                    "description": "Subject line goes here"
                  },
                  "from": {
                    "type": "string",
                    "description": "YourDomain.com <sender@yourdomain.com>"
                  },
                  "reply_to": {
                    "type": "string",
                    "format": "email",
                    "description": "reply-to@yourdomain.com"
                  },
                  "body": {
                    "type": "string",
                    "description": "Body content goes here"
                  },
                  "attachments": {
                    "type": "object",
                    "properties": {
                      "file1.extension": {
                        "type": "string",
                        "description": "base64 encoded string"
                      },
                      "file2.extension": {
                        "type": "string",
                        "description": "base64 encoded string"
                      }
                    }
                  },
                  "bcc": {
                    "type": "string",
                    "format": "email",
                    "description": "extraemail@example.com"
                  },
                  "headers": {
                    "type": "object",
                    "properties": {
                      "List-Unsubscribe": {
                        "type": "string",
                        "description": "\"List-Unsubscribe\": \"<https://yourdomain.com/unsub?t=abc>, <mailto:unsub@yourdomain.com>\""
                      },
                      "List-Unsubscribe-Post": {
                        "type": "string",
                        "description": "\"List-Unsubscribe-Post\":\"List-Unsubscribe=One-Click\""
                      }
                    }
                  }
                }
              },
              "example": {
                "to": "email@example.com",
                "subject": "Subject line goes here",
                "from": "YourDomain.com <sender@yourdomain.com>",
                "reply_to": "reply-to@yourdomain.com",
                "body": "Body content goes here"
              }
            }
          }
        }
      }
    }
  }
}
```