Getting Started

This is a quick tutorial to get you started using our API. We will show you how to send your first email, how to authenticate with our API and tell you more about MailTarget RESTful API.


Make Your First Request

Give it a go and send your first email. This simple example shows how to send an email with the API in a few easy steps.

First, you need to have active domain address in the MailTarget Transactional. Visit the Domain Overview section to check and setup your domain.

Second, you need to find your credentials, the API Key in the Domain Information section.

curl -s \
  -X POST \
  https://trx.mailtarget.co/outbox \
  -H 'Content-Type: application/json' \
  -d '{
    "accessToken": "$MT_APIKEY",
    "from": "$SENDER_EMAIL",
    "to": [
        "$RECIPIENT_EMAIL"
    ],
    "labels": [
        "$LABEL_EMAIL"
    ],
    "subject": "Hello",
    "content": "<!DOCTYPE html><html><head><meta charset=\"utf-8\"/><title>Hello</title></head><body><h3>My First Email Sent by MailTarget</h3></body></html>",
    "track": true
    }'
Parameter Description
$MT_APIKEY Your API Key
$SENDER_EMAIL Sender email address with domain of your register
$RECIPIENT_EMAIL Recipient email address of your test
$LABEL_EMAIL Label email which you use for view report easily



×

Subscribe

The latest tutorials sent straight to your inbox.