Skip to content

Send an email

All emails sent through Transactional Email Service require the use of a template. Raw content cannot be sent in a request. All emails sent must have a transactional element which means they must contain something the recipient can act on.

Important: Make sure to never send to email addresses that don’t exist, even in testing.

To send an email:

  • API Call: POST {baseurl} /messages/send

  • HEADER:

    • Include Identity OAuth Bearer token for your application
    • Add a Content-Type of application/JSON.
  • BODY: (See Example Below) Base your body on the example code below.

  • Required attributes:

    • locale = {Supported locale code}
    • template
    • [to] = string for one email address; or string array with up to 10 email addresses
    • template_variables = “key”: “value”
  • Optional attributes:

    • [cc] = string for one email address; or string array with up to 10 email addresses
    • [bcc] = string for one email address; or string array with up to 10 email addresses
    • attachments = List of attachments containing name of the attachment, type of attachment and base64 encoded content. The total size of all attachments added together must be 3MB or less. Supported attachment types “txt”, “jpeg”, “jpg”, “html”, “pdf”, “png”, “doc”, “docx”, “xls”, “xlsx”, “csv”, “gpx”, “xml”, and “zip”.
    • sender_name = String representing the sender name appearing on the email.
    • footer_address = A footer address is an additional component that adds an address to the email footer. If the user does not specify an address in the API call, Trimble headquarters’ address is added by default:
    Trimble Inc.,10368 Westmoor Drive
    Westminster, CO 80021

The application ID must be eligible for the template.

Example request body: Send to a single email ID

{
    "locale": "en",
    "template": "5fa5bc59-8aaa-44c7-b4ec-763fe66e1931",
    "to": "customer@domain.com",
    "template_variables":
    {
        "recipient_first_name": "John",
        "identity_url": "https://id.trimble.com",
        "del_revoke_url" : "https://id.trimble.com"
    }
}

Example request body: Send to multiple email IDs

{
    "locale": "en",
    "template": "5fa5bc59-8aaa-44c7-b4ec-763fe66e1931",
    "to": ["customer@domain.com","customer2@domain.com"],
    "template_variables":
    {
        "recipient_first_name": "John",
        "identity_url": "https://id.trimble.com",
        "del_revoke_url" : "https://id.trimble.com"
    }
}

Example request body: Send email with attachments

{
    "locale": "en",
    "template": "5fa5bc59-8aaa-44c7-b4ec-763fe66e1931",
    "to": "customer@domain.com",
    "template_variables":
    {
        "recipient_first_name": "John",
        "identity_url": "https://id.trimble.com",
        "del_revoke_url" : "https://id.trimble.com"
    },
    "attachments": [
    {
      "name": "hello.txt",
      "type": "text/plain",
      "content": "SGVsbG8="
    }]
}

Example request body: Send email with cc and bcc

{
    "locale": "en",
    "template": "5fa5bc59-8aaa-44c7-b4ec-763fe66e1931",
    "to": "customer@domain.com",
    "cc":"customer1@domain.com",
    "bcc":"customer2@domain.com",
    "template_variables":
    {
    "recipient_first_name": "John",
    "identity_url": "https://id.trimble.com",
    "del_revoke_url" : "https://id.trimble.com"
    }
}

Example request body: Send email with a mailing address in the footer

{
    "locale": "en",
    "template": "5fa5bc59-8aaa-44c7-b4ec-763fe66e1931",
    "to": "customer@domain.com",
    "template_variables":
    {
        "recipient_first_name": "John",
        "identity_url": "https://id.trimble.com",
        "del_revoke_url" : "https://id.trimble.com"
    },
    "footer_address":
    {
        "street_address": "10368 Westmoor Drive",
        "city": "Westminster",
        "state": "CO",
        "zip_code": "80021",
       "country": "USA"
    }
}

Example response:

{
    "message_id": "20200814175120.1.F259BE81389518C5@account.trimble.com"
}

Errors returned may be directly related to email sending issues. Please refer to a list of Common SMTP Errors (turboSMTP website) for more specific information.