Email

Sends an email or a bunch of emails

While sending you can provide substitutions (merge tags), use a template, turn on read or click tracking, etc.

Restrictions:

  • maximum request size is 10 MB
  • maximum number of recipients is 500
  • The symbol '/' is not allowed in attachment names

If the list of recipients contains invalid, non-existent, duplicate, or unsubscribed emails, those emails will be returned in the output parameter failed_emails, and the email will be sent to all other valid emails addresses. If all the emails addresses fall into failed_emails, sending will not be carried out and API error 204 will be returned.

post/email/send.json

Request

  • Base URL: https://api.unione.io/en/transactional/api/v1
  • URL: https://api.unione.io/en/transactional/api/v1/email/send.json
  • Auth: API key in header X-API-KEY

Request body

Example request

{
  "message": {
    "recipients": [
      {
        "email": "email@example.com",
        "substitutions": {
          "tag": "value"
        },
        "metadata": {
          "key": "value"
        }
      }
    ],
    "template_id": "00000000-0000-0000-0000-000000000000",
    "tags": [],
    "global_language": "en",
    "template_engine": "velocity",
    "body": {
      "html": "<b>Hello, &#7b;&#7b;to_name&#7c;&#7c;</b>",
      "plaintext": "Hello, &#7b;&#7b;to_name&#7c;&#7c;",
      "amp": "<!doctype html><html amp4email><head> <meta charset=\"utf-8\"><script async src=\"https://cdn.ampproject.org/v0.js\"></script> <style amp4email-boilerplate>body{visibility:hidden}</style></head><body> Hello, AMP4EMAIL world.</body></html>"
    },
    "subject": "UniOne test email ",
    "from_email": "email@example.com",
    "from_name": "John Smith",
    "reply_to": "email@example.com",
    "reply_to_name": "John Smith",
    "idempotence_key": "SG1VsbG68sIH2dvc5mx890kIQ",
    "headers": {
      "X-MyHeader": "some data",
      "Test-List-Unsubscribe": "<mailto: unsubscribe@example.com?subject=unsubscribe>, <http://www.example.com/unsubscribe/&#7b;&#7b;CustomerId&#7c;&#7c;>"
    },
    "attachments": [
      {
        "type": "text/plain",
        "name": "readme.txt",
        "content": "SGVsbG8sIHdvcmxkIQ=="
      }
    ],
    "inline_attachments": [
      {
        "type": "image/gif",
        "name": "IMAGECID1",
        "content": "R0lGODdhAwADAIABAP+rAP///ywAAAAAAwADAAACBIQRBwUAOw=="
      }
    ],
    "options": {}
  }
}

Response

Email successfully accepted for sending.

status'success' required

"success" string

job_idstring required

Job identifier, might be useful for investigating errors.

emailsstring[]

Array of recipients emails successfully accepted for sending.

failed_emailsobject

Object with emails rejected for sending as property names and their statuses as property values, e.g.: {"email1@gmail.com": "temporary_unavailable"}. Possible statuses:<ul><li>unsubscribed - specified email is unsubscribed;<li>invalid - the email does not exist or has been entered incorrectly;<li>duplicate - the email already exists in the request, email duplicating is prevented;<li>temporary_unavailable - the email address is unavailable. This means that over the next three days sending to this address will return an error. Email may be temporarily unavailable due to several reasons, e.g.: <ol><li>a previous email has been rejected by the recipient's server for spam;<li>the recipient's mailbox is full or is not used;<li>recipient's domain does not accept mail;<li>sending server was rejected due to blacklisting;</ol><li>permanent_unavailable - the email address is permanently unavailable or unsubscribed globally.<li>complained - the recipient reported spam in the previous emails;<li>blocked - sending to the email is prohibited by administration of UniOne.</ul>We may added new statuses in the future.

Example response

{
  "job_id": "1ZymBc-00041N-9X",
  "failed_emails": {
    "email1@gmail.com": "temporary_unavailable",
    "bad@address": "invalid",
    "email@example.com": "duplicate",
    "root@example.org": "permanent_unavailable",
    "olduser@example.net": "unsubscribed"
  }
}

Changes

No recorded changes to this operation across all 1 revision of this API.