Send Email

The send command is used to send an email to a single recipient or multiple recipients.  

To use the send command POST to https://api.elasticemail.com/mailer/send with the following form values:

  • username=your account email address
  • api_key=your api key
  • from=from email address
  • from_name=display name for from email address
  • to=semi colon separated list of email recipients (each email is treated separately, like a BCC)
  • subject=email subject 
  • body_html=html email body [optional]
  • body_text=text email body [optional]
  • reply_to=email address to reply to [optional]
  • reply_to_name=display name of the reply to address [optional]
  • channel=an id field (max 60 chars) that can be used for reporting [optional - will default to from address]
  • charset=text value of encoding for example: iso-8859-1, windows-1251, utf-8, us-ascii, windows-1250 and more…
  • encodingtype=0 for None, 1 for Raw7Bit, 2 for Raw8Bit, 3 for QuotedPrintable, 4 for Base64 (Default), 5 for Uue  note that you can also provide the text version such as "Raw7Bit" for value 1.  NOTE: Base64 or QuotedPrintable is recommended if you are validating your domain(s) with DKIM.

Optional Templates and contact lists:
  • template=the name of an email template you have created in your account. If you send a template [optional]
  • merge_firstname,merge_lastname= if sending to a template you can send merge_ fields to merge data with the template. Template fields are entered with {firstname}, {lastname} etc. [optional]

  • lists=the name of a contact list you would like to send to. Separate multiple contact lists by commas. [optional]

Optional sender header. If you are sending on behalf of many clients with different from addresses use:

  • sender=email address of the sender [optional]
  • sender_name=display name sender [optional]

Optional scheduling. If you would like to schedule your email to be delivered in the future (drip campaigns etc):

  • time_offset_minutes=number of minutes in the future this email should be sent [optional]
Optional Custom Headers.  If you would like to add custom headers to your email you can do so by defining parameter's header1, header2, header3, etc and providing it a custom header name and header value.  Note: a space is required after the colon before the custom header value.
  • header1=customheader1: header-value1
  • header2=customheader2: header-value2
  • header3=customheader3: header-value3
  • etc
Note: When you have more than one recipient in the "to" field each recipient will receive their own individually delivered copy of the email.  Recipients will not see each other's email addresses. 

Response:

If sent correctly you will receive a response like:

f74b9f96-f89a-4cfe-813f-5f86df1cb37f

This is the transaction ID of your send job.  You can use this transaction ID to check on the status of the given job using the Get Status api.

Code Samples

PHP

There is also a Zend Framework class for delivering mail via Elastic Email. Special thanks to Marco Pracucci of Spreaker (http://spreaker.com) who provided this:  Zend_Mail_Transport

PHP Using CURL

C#

Java

Python

Perl

ASP.NET


Force.com


Ruby


Objective C (iPhone)


Node.js Application


If you've written this (or any of our other API calls) in a language we don't have in our samples send us your working code and we'll put a bonus $50 of Elastic Email credit in your account as a big thank you!