Skip to main content
All CollectionsEmail APISandbox
How to send email with Mailtarget sandbox
How to send email with Mailtarget sandbox
S
Written by Support Mailtarget
Updated over a week ago

Welcome to Mailtarget sandbox, to start sending emails, please follow the steps below:

  1. Add authorized recipients

    Add the authorized recipients permitted to receive testing emails. After you add the authorized recipients, their status will remain unverified. The recipients must verify their authorization through the email sent to them.

    Verify authorized recipients by clicking the "Give Consent" button in the email.

  1. Sending email using the API, SDK or SMTP with Postman or directly with your application

    You can start sending email with our sandbox environment using the API, SDK or SMTP. You can try using the script code provided in the documentation below:

    1. Sending email using API

      curl --location 'https://transmission.mailtarget.co/v1/layang/transmissions' \
      --header 'accept: application/json' \
      --header 'Content-Type: application/json' \
      --header 'Authorization: Bearer API_KEY' \
      --data-raw '{
      "bodyText": "Congratulation, you just sent email with Mailtarget. You are truly awesome!",
      "bodyHtml": "<!DOCTYPE html><html lang=\"en\"><head><meta charset=\"UTF-8\"><title>Body HTML</title></head><body><p>Congratulation, you just sent email with Mailtarget. You are truly awesome!</p></body></html>",
      "from": {
      "email": "SENDER_EMAIL",
      "name": "SENDER_NAME"
      },
      "subject": "Hello from Mailtarget",
      "to": [
      {
      "email": "RECIPIENT_EMAIL",
      "name": "RECIPIENT_NAME"
      }
      ],
      "replyTo": [
      {
      "email": "RECIPIENT_EMAIL",
      "name": "RECIPIENT_NAME"
      }
      ],
      "cc": [
      {
      "email": "RECIPIENT_EMAIL",
      "name": "RECIPIENT_NAME"
      }
      ],
      "bcc": [
      {
      "email": "RECIPIENT_EMAIL",
      "name": "RECIPIENT_NAME"
      }
      ]
      }'

      Note :

      • API_KEY → change with API Key

      • SENDER_EMAIL → change with sender email

      • SENDER_NAME → change with sender name

      • RECIPIENT_EMAIL → change with recipient email

      • RECIPIENT_NAME → change with recipient name

    2. Sending email using SDK

      Follow the configuration steps in README.md file in our SDK below:

    3. Sending email using SMTP

      Run this on your terminal using swaks:

      swaks --to RECIPIENT_EMAIL \
      --from [email protected] \
      --auth [email protected] \
      --auth-password=API Key \
      --server smtp-sandbox.mtrgt.net:587 \
      --h-Subject: "Hello from Mailtarget" \
      --body 'Congratulation, you just sent email with Mailtarget. You are truly awesome!' \
      -tls

  1. Once you have run the code and receive the email, that means everything is running

  1. Check Activity menu to view the results

    Based on the example delivery activity above, the status "Injection" means the email has been successfully relayed to Mailtarget, and the status "Delivery" means the email has been successfully sent to the recipient's server.

Congratulations! You have successfully sent an email using Mailtarget!

Did this answer your question?