Email API

Default

sendPost

Send a message over MailChannels API

click-tracking notes: * if the URL of the 'a' tag is empty within the HTML body or doesn't start with http/https, or has a clicktracking attribute with a value of 'off', it will be ignored.


/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"
    } ],
    "reply_to" : {
      "name" : "name",
      "email" : "email"
    },
    "dkim_domain" : "dkim_domain",
    "subject" : "subject",
    "dkim_private_key" : "dkim_private_key",
    "dynamic_template_data" : "{}",
    "from" : {
      "name" : "name",
      "email" : "email"
    },
    "to" : [ {
      "name" : "name",
      "email" : "email"
    } ],
    "dkim_selector" : "dkim_selector"
  } ],
  "attachments" : [ {
    "filename" : "filename",
    "type" : "type",
    "content" : "content"
  } ],
  "reply_to" : {
    "name" : "name",
    "email" : "email"
  },
  "tracking_settings" : {
    "click_tracking" : {
      "enable" : false
    },
    "open_tracking" : {
      "enable" : false
    }
  },
  "subject" : "subject",
  "from" : {
    "name" : "name",
    "email" : "email"
  },
  "mailfrom" : {
    "name" : "name",
    "email" : "email"
  },
  "content" : [ {
    "template_type" : "mustache",
    "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();
        String xApiKey = xApiKey_example; // String | 
        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(xApiKey, 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();
        String xApiKey = xApiKey_example; // String | 
        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(xApiKey, 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];
String *xApiKey = xApiKey_example; //  (default to null)
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:xApiKey
    mailSendBody:mailSendBody
    dryRun:dryRun
              completionHandler: ^(Message output, NSError* error) {
    if (output) {
        NSLog(@"%@", output);
    }
    if (error) {
        NSLog(@"Error: %@", error);
    }
}];
var EmailApi = require('email_api');

// Create an instance of the API class
var api = new EmailApi.DefaultApi()
var xApiKey = xApiKey_example; // {String} 
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(xApiKey, 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 xApiKey = xApiKey_example;  // String |  (default to null)
            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(xApiKey, 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();
$xApiKey = xApiKey_example; // String | 
$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($xApiKey, $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 $xApiKey = xApiKey_example; # String | 
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(xApiKey => $xApiKey, 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()
xApiKey = xApiKey_example # String |  (default to null)
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(xApiKey, 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 xApiKey = xApiKey_example; // String
    let mailSendBody = ; // MailSendBody
    let dryRun = true; // Boolean

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

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

Scopes

Parameters

Header parameters
Name Description
X-Api-Key*
String
Required
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


webhookDelete

Delete all webhook endpoints for a customer.


/webhook

Usage and SDK Samples

curl -X DELETE \
 "https://api.mailchannels.net/tx/v1/webhook"
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();
        String xApiKey = xApiKey_example; // String | 

        try {
            apiInstance.webhookDelete(xApiKey);
        } catch (ApiException e) {
            System.err.println("Exception when calling DefaultApi#webhookDelete");
            e.printStackTrace();
        }
    }
}
import org.openapitools.client.api.DefaultApi;

public class DefaultApiExample {
    public static void main(String[] args) {
        DefaultApi apiInstance = new DefaultApi();
        String xApiKey = xApiKey_example; // String | 

        try {
            apiInstance.webhookDelete(xApiKey);
        } catch (ApiException e) {
            System.err.println("Exception when calling DefaultApi#webhookDelete");
            e.printStackTrace();
        }
    }
}


// Create an instance of the API class
DefaultApi *apiInstance = [[DefaultApi alloc] init];
String *xApiKey = xApiKey_example; //  (default to null)

// Delete all webhook endpoints for a customer.
[apiInstance webhookDeleteWith:xApiKey
              completionHandler: ^(NSError* error) {
    if (error) {
        NSLog(@"Error: %@", error);
    }
}];
var EmailApi = require('email_api');

// Create an instance of the API class
var api = new EmailApi.DefaultApi()
var xApiKey = xApiKey_example; // {String} 

var callback = function(error, data, response) {
  if (error) {
    console.error(error);
  } else {
    console.log('API called successfully.');
  }
};
api.webhookDelete(xApiKey, callback);
using System;
using System.Diagnostics;
using Org.OpenAPITools.Api;
using Org.OpenAPITools.Client;
using Org.OpenAPITools.Model;

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

            // Create an instance of the API class
            var apiInstance = new DefaultApi();
            var xApiKey = xApiKey_example;  // String |  (default to null)

            try {
                // Delete all webhook endpoints for a customer.
                apiInstance.webhookDelete(xApiKey);
            } catch (Exception e) {
                Debug.Print("Exception when calling DefaultApi.webhookDelete: " + e.Message );
            }
        }
    }
}
<?php
require_once(__DIR__ . '/vendor/autoload.php');

// Create an instance of the API class
$api_instance = new OpenAPITools\Client\Api\DefaultApi();
$xApiKey = xApiKey_example; // String | 

try {
    $api_instance->webhookDelete($xApiKey);
} catch (Exception $e) {
    echo 'Exception when calling DefaultApi->webhookDelete: ', $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 $xApiKey = xApiKey_example; # String | 

eval {
    $api_instance->webhookDelete(xApiKey => $xApiKey);
};
if ($@) {
    warn "Exception when calling DefaultApi->webhookDelete: $@\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()
xApiKey = xApiKey_example # String |  (default to null)

try:
    # Delete all webhook endpoints for a customer.
    api_instance.webhook_delete(xApiKey)
except ApiException as e:
    print("Exception when calling DefaultApi->webhookDelete: %s\n" % e)
extern crate DefaultApi;

pub fn main() {
    let xApiKey = xApiKey_example; // String

    let mut context = DefaultApi::Context::default();
    let result = client.webhookDelete(xApiKey, &context).wait();

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

Scopes

Parameters

Header parameters
Name Description
X-Api-Key*
String
Required

Responses


webhookGet

Fetch customer's webhooks.


/webhook

Usage and SDK Samples

curl -X GET \
 -H "Accept: application/json" \
 "https://api.mailchannels.net/tx/v1/webhook"
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();
        String xApiKey = xApiKey_example; // String | 

        try {
            array[Webhook] result = apiInstance.webhookGet(xApiKey);
            System.out.println(result);
        } catch (ApiException e) {
            System.err.println("Exception when calling DefaultApi#webhookGet");
            e.printStackTrace();
        }
    }
}
import org.openapitools.client.api.DefaultApi;

public class DefaultApiExample {
    public static void main(String[] args) {
        DefaultApi apiInstance = new DefaultApi();
        String xApiKey = xApiKey_example; // String | 

        try {
            array[Webhook] result = apiInstance.webhookGet(xApiKey);
            System.out.println(result);
        } catch (ApiException e) {
            System.err.println("Exception when calling DefaultApi#webhookGet");
            e.printStackTrace();
        }
    }
}


// Create an instance of the API class
DefaultApi *apiInstance = [[DefaultApi alloc] init];
String *xApiKey = xApiKey_example; //  (default to null)

// Fetch customer's webhooks.
[apiInstance webhookGetWith:xApiKey
              completionHandler: ^(array[Webhook] output, NSError* error) {
    if (output) {
        NSLog(@"%@", output);
    }
    if (error) {
        NSLog(@"Error: %@", error);
    }
}];
var EmailApi = require('email_api');

// Create an instance of the API class
var api = new EmailApi.DefaultApi()
var xApiKey = xApiKey_example; // {String} 

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

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

            // Create an instance of the API class
            var apiInstance = new DefaultApi();
            var xApiKey = xApiKey_example;  // String |  (default to null)

            try {
                // Fetch customer's webhooks.
                array[Webhook] result = apiInstance.webhookGet(xApiKey);
                Debug.WriteLine(result);
            } catch (Exception e) {
                Debug.Print("Exception when calling DefaultApi.webhookGet: " + e.Message );
            }
        }
    }
}
<?php
require_once(__DIR__ . '/vendor/autoload.php');

// Create an instance of the API class
$api_instance = new OpenAPITools\Client\Api\DefaultApi();
$xApiKey = xApiKey_example; // String | 

try {
    $result = $api_instance->webhookGet($xApiKey);
    print_r($result);
} catch (Exception $e) {
    echo 'Exception when calling DefaultApi->webhookGet: ', $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 $xApiKey = xApiKey_example; # String | 

eval {
    my $result = $api_instance->webhookGet(xApiKey => $xApiKey);
    print Dumper($result);
};
if ($@) {
    warn "Exception when calling DefaultApi->webhookGet: $@\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()
xApiKey = xApiKey_example # String |  (default to null)

try:
    # Fetch customer's webhooks.
    api_response = api_instance.webhook_get(xApiKey)
    pprint(api_response)
except ApiException as e:
    print("Exception when calling DefaultApi->webhookGet: %s\n" % e)
extern crate DefaultApi;

pub fn main() {
    let xApiKey = xApiKey_example; // String

    let mut context = DefaultApi::Context::default();
    let result = client.webhookGet(xApiKey, &context).wait();

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

Scopes

Parameters

Header parameters
Name Description
X-Api-Key*
String
Required

Responses


webhookPost

Enroll a customer for event webhooks.


/webhook

Usage and SDK Samples

curl -X POST \
 "https://api.mailchannels.net/tx/v1/webhook?endpoint=endpoint_example"
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();
        String endpoint = endpoint_example; // String | the URL to which the webhook should be sent
        String xApiKey = xApiKey_example; // String | 

        try {
            apiInstance.webhookPost(endpoint, xApiKey);
        } catch (ApiException e) {
            System.err.println("Exception when calling DefaultApi#webhookPost");
            e.printStackTrace();
        }
    }
}
import org.openapitools.client.api.DefaultApi;

public class DefaultApiExample {
    public static void main(String[] args) {
        DefaultApi apiInstance = new DefaultApi();
        String endpoint = endpoint_example; // String | the URL to which the webhook should be sent
        String xApiKey = xApiKey_example; // String | 

        try {
            apiInstance.webhookPost(endpoint, xApiKey);
        } catch (ApiException e) {
            System.err.println("Exception when calling DefaultApi#webhookPost");
            e.printStackTrace();
        }
    }
}


// Create an instance of the API class
DefaultApi *apiInstance = [[DefaultApi alloc] init];
String *endpoint = endpoint_example; // the URL to which the webhook should be sent (default to null)
String *xApiKey = xApiKey_example; //  (default to null)

// Enroll a customer for event webhooks.
[apiInstance webhookPostWith:endpoint
    xApiKey:xApiKey
              completionHandler: ^(NSError* error) {
    if (error) {
        NSLog(@"Error: %@", error);
    }
}];
var EmailApi = require('email_api');

// Create an instance of the API class
var api = new EmailApi.DefaultApi()
var endpoint = endpoint_example; // {String} the URL to which the webhook should be sent
var xApiKey = xApiKey_example; // {String} 

var callback = function(error, data, response) {
  if (error) {
    console.error(error);
  } else {
    console.log('API called successfully.');
  }
};
api.webhookPost(endpoint, xApiKey, callback);
using System;
using System.Diagnostics;
using Org.OpenAPITools.Api;
using Org.OpenAPITools.Client;
using Org.OpenAPITools.Model;

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

            // Create an instance of the API class
            var apiInstance = new DefaultApi();
            var endpoint = endpoint_example;  // String | the URL to which the webhook should be sent (default to null)
            var xApiKey = xApiKey_example;  // String |  (default to null)

            try {
                // Enroll a customer for event webhooks.
                apiInstance.webhookPost(endpoint, xApiKey);
            } catch (Exception e) {
                Debug.Print("Exception when calling DefaultApi.webhookPost: " + e.Message );
            }
        }
    }
}
<?php
require_once(__DIR__ . '/vendor/autoload.php');

// Create an instance of the API class
$api_instance = new OpenAPITools\Client\Api\DefaultApi();
$endpoint = endpoint_example; // String | the URL to which the webhook should be sent
$xApiKey = xApiKey_example; // String | 

try {
    $api_instance->webhookPost($endpoint, $xApiKey);
} catch (Exception $e) {
    echo 'Exception when calling DefaultApi->webhookPost: ', $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 $endpoint = endpoint_example; # String | the URL to which the webhook should be sent
my $xApiKey = xApiKey_example; # String | 

eval {
    $api_instance->webhookPost(endpoint => $endpoint, xApiKey => $xApiKey);
};
if ($@) {
    warn "Exception when calling DefaultApi->webhookPost: $@\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()
endpoint = endpoint_example # String | the URL to which the webhook should be sent (default to null)
xApiKey = xApiKey_example # String |  (default to null)

try:
    # Enroll a customer for event webhooks.
    api_instance.webhook_post(endpoint, xApiKey)
except ApiException as e:
    print("Exception when calling DefaultApi->webhookPost: %s\n" % e)
extern crate DefaultApi;

pub fn main() {
    let endpoint = endpoint_example; // String
    let xApiKey = xApiKey_example; // String

    let mut context = DefaultApi::Context::default();
    let result = client.webhookPost(endpoint, xApiKey, &context).wait();

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

Scopes

Parameters

Header parameters
Name Description
X-Api-Key*
String
Required
Query parameters
Name Description
endpoint*
String
the URL to which the webhook should be sent
Required

Responses