Send mails

Once you´ve created or updated a draft you probably want to send it aswell. This is possible through the send object.

Required fields

  • lists
  • sender_id or sender_email

Optional fields

  • test
  • tracking
  • tell_a_friend
  • time_to_send
  • sender_name

Readonly fields

  • body
  • url
  • plain_text
  • type
  • preview_url
  • css
  • subject

Example send email

{
    "sender_name": "John Doe",
    "lists": ["hiso7tuNb4Z", "s5NaP93Oojg"],
    "sender_email": "john.doe@example.com",
    "test": true,
    "css": "",
    "tracking": 0,
    "tell_a_friend": "s5NaP93Oojg",
    "time_to_send": "2013-05-07T12:00:00"
}

POST /mails/drafts/<id>/send/

You are only able to send drafts. This endpoint queues the mail for sending. Set time_to_send to null or just leave it out to send the email now.

Test mails

You can send test mails to make sure that the mail looks good in your email client. Test mails don´t affect your email balance and you can have a maximum of 20 receivers in the list(s). We will ignore the analytics identifier and the mail will still be a draft and available under /mails/drafts/ after you´ve sent it.

It will not be under /mails/sheduled/ or /mails/sent/ because you probably want to send the live version once you verified that everything looks ok in your test mail.

Scheduled mails

To start a scheduled mail you set the time_to_send argument to the desired sending time. If you skip this argument it will be sent immediately as a regular mail.

Tell a friend

The "tell a friend" link gives you the opportunity to include a link in your mail that recipients can open and tell others about your newsletter through a web form. The web form is connected to a specific list on your account.

If you have a "tell a friend"-link and are sending to multiple lists you can choose which of the lists the link will go to by defining the hash of that list. Remember that the list must be one of the lists you are sending to.

Tracking

The tracking attribute allows you to set a tracking method for your newsletter. Currently the only method supported is via Google Analytics. Accepted values:

  • False/[]: Do not use tracking
  • True: Use the default tracking(using Google Analytics). The following attributes are set:

    utm_source: getanewsletter utm_campaign: cmp_<mail_id> - List with hashes specifying the tracking type and the passed parameters.

Example:

[{
    "type": 0,
    "params": {
        "utm_source": "newsletter_campaign",
        "utm_campaign": "123456789"
    }
}]

The type attribute specifies the tracking method used(0 is for Google Analytics) and the params attribute specifies the attributes and their values used by the method.


The response code will be 202 Accepted if there where no problems.

Example:

POST /mails/drafts/<id>/send/

{
    "sender_name": "John Doe",
    "sender_email": "john.doe@example.com",
    "time_to_send": "2013-05-07T12:00:00",
    "tell_a_friend": "s5NaP93Oojg",
    "lists": ["hiso7tuNb4Z", "s5NaP93Oojg"],
    "tracking": True,
}

Response

Status code: 202 Accepted