Transactional API

Default

sendPost

Send a message over MailChannels API


/send

Usage and SDK Samples

curl -X POST \
 -H "Accept: application/json" \
 -H "Content-Type: application/json" \
 "https://api.mailchannels.net/tx/v1/send?dry-run=true" \
 -d '{
  "headers" : {
    "key" : "headers"
  },
  "personalizations" : [ {
    "cc" : [ {
      "name" : "name",
      "email" : "email"
    } ],
    "headers" : {
      "key" : "headers"
    },
    "bcc" : [ {
      "name" : "name",
      "email" : "email"
    } ],
    "dkim_domain" : "dkim_domain",
    "subject" : "subject",
    "dkim_private_key" : "dkim_private_key",
    "to" : [ {
      "name" : "name",
      "email" : "email"
    } ],
    "dkim_selector" : "dkim_selector"
  } ],
  "subject" : "subject",
  "content" : [ {
    "type" : "type",
    "value" : "value"
  } ]
}'
import org.openapitools.client.*;
import org.openapitools.client.auth.*;
import org.openapitools.client.model.*;
import org.openapitools.client.api.DefaultApi;

import java.io.File;
import java.util.*;

public class DefaultApiExample {
    public static void main(String[] args) {

        // Create an instance of the API class
        DefaultApi apiInstance = new DefaultApi();
        MailSendBody mailSendBody = ; // MailSendBody | 
        Boolean dryRun = true; // Boolean | When present and set to true, the message will not be sent. Instead, the fully rendered
message is returned. This can be useful for testing.


        try {
            Message result = apiInstance.sendPost(mailSendBody, dryRun);
            System.out.println(result);
        } catch (ApiException e) {
            System.err.println("Exception when calling DefaultApi#sendPost");
            e.printStackTrace();
        }
    }
}
import org.openapitools.client.api.DefaultApi;

public class DefaultApiExample {
    public static void main(String[] args) {
        DefaultApi apiInstance = new DefaultApi();
        MailSendBody mailSendBody = ; // MailSendBody | 
        Boolean dryRun = true; // Boolean | When present and set to true, the message will not be sent. Instead, the fully rendered
message is returned. This can be useful for testing.


        try {
            Message result = apiInstance.sendPost(mailSendBody, dryRun);
            System.out.println(result);
        } catch (ApiException e) {
            System.err.println("Exception when calling DefaultApi#sendPost");
            e.printStackTrace();
        }
    }
}


// Create an instance of the API class
DefaultApi *apiInstance = [[DefaultApi alloc] init];
MailSendBody *mailSendBody = ; // 
Boolean *dryRun = true; // When present and set to true, the message will not be sent. Instead, the fully rendered
message is returned. This can be useful for testing.
 (optional) (default to null)

// Send a message over MailChannels API
[apiInstance sendPostWith:mailSendBody
    dryRun:dryRun
              completionHandler: ^(Message output, NSError* error) {
    if (output) {
        NSLog(@"%@", output);
    }
    if (error) {
        NSLog(@"Error: %@", error);
    }
}];
var TransactionalApi = require('transactional_api');

// Create an instance of the API class
var api = new TransactionalApi.DefaultApi()
var mailSendBody = ; // {MailSendBody} 
var opts = {
  'dryRun': true // {Boolean} When present and set to true, the message will not be sent. Instead, the fully rendered
message is returned. This can be useful for testing.

};

var callback = function(error, data, response) {
  if (error) {
    console.error(error);
  } else {
    console.log('API called successfully. Returned data: ' + data);
  }
};
api.sendPost(mailSendBody, opts, callback);
using System;
using System.Diagnostics;
using Org.OpenAPITools.Api;
using Org.OpenAPITools.Client;
using Org.OpenAPITools.Model;

namespace Example
{
    public class sendPostExample
    {
        public void main()
        {

            // Create an instance of the API class
            var apiInstance = new DefaultApi();
            var mailSendBody = new MailSendBody(); // MailSendBody | 
            var dryRun = true;  // Boolean | When present and set to true, the message will not be sent. Instead, the fully rendered
message is returned. This can be useful for testing.
 (optional)  (default to null)

            try {
                // Send a message over MailChannels API
                Message result = apiInstance.sendPost(mailSendBody, dryRun);
                Debug.WriteLine(result);
            } catch (Exception e) {
                Debug.Print("Exception when calling DefaultApi.sendPost: " + e.Message );
            }
        }
    }
}
<?php
require_once(__DIR__ . '/vendor/autoload.php');

// Create an instance of the API class
$api_instance = new OpenAPITools\Client\Api\DefaultApi();
$mailSendBody = ; // MailSendBody | 
$dryRun = true; // Boolean | When present and set to true, the message will not be sent. Instead, the fully rendered
message is returned. This can be useful for testing.


try {
    $result = $api_instance->sendPost($mailSendBody, $dryRun);
    print_r($result);
} catch (Exception $e) {
    echo 'Exception when calling DefaultApi->sendPost: ', $e->getMessage(), PHP_EOL;
}
?>
use Data::Dumper;
use WWW::OPenAPIClient::Configuration;
use WWW::OPenAPIClient::DefaultApi;

# Create an instance of the API class
my $api_instance = WWW::OPenAPIClient::DefaultApi->new();
my $mailSendBody = WWW::OPenAPIClient::Object::MailSendBody->new(); # MailSendBody | 
my $dryRun = true; # Boolean | When present and set to true, the message will not be sent. Instead, the fully rendered
message is returned. This can be useful for testing.


eval {
    my $result = $api_instance->sendPost(mailSendBody => $mailSendBody, dryRun => $dryRun);
    print Dumper($result);
};
if ($@) {
    warn "Exception when calling DefaultApi->sendPost: $@\n";
}
from __future__ import print_statement
import time
import openapi_client
from openapi_client.rest import ApiException
from pprint import pprint

# Create an instance of the API class
api_instance = openapi_client.DefaultApi()
mailSendBody =  # MailSendBody | 
dryRun = true # Boolean | When present and set to true, the message will not be sent. Instead, the fully rendered
message is returned. This can be useful for testing.
 (optional) (default to null)

try:
    # Send a message over MailChannels API
    api_response = api_instance.send_post(mailSendBody, dryRun=dryRun)
    pprint(api_response)
except ApiException as e:
    print("Exception when calling DefaultApi->sendPost: %s\n" % e)
extern crate DefaultApi;

pub fn main() {
    let mailSendBody = ; // MailSendBody
    let dryRun = true; // Boolean

    let mut context = DefaultApi::Context::default();
    let result = client.sendPost(mailSendBody, dryRun, &context).wait();

    println!("{:?}", result);
}

Scopes

Parameters

Body parameters
Name Description
mailSendBody *

Query parameters
Name Description
dry-run
Boolean
When present and set to true, the message will not be sent. Instead, the fully rendered message is returned. This can be useful for testing.

Responses