Send an email
Sends one email now, from your organization’s sending address. This sends real email to real people, and it cannot be undone. Once the email service accepts a message it is on its way, and nothing can recall it. There is no test mode.
Who it goes to: person_id sends to that person’s email on file; recipient_address sends to that address, and wins when you send both. cc and bcc add up to 20 copies each.
What it says: either template_key, naming an active template, or both subject and body_text. A template is filled from the person, from the animal or adoption application in related_entity_type and related_entity_id, and from your organization’s name; what you send in variables wins over the records. If any merge field is left unfilled, nothing is sent and the answer is 400. Merge fields are written {{first_name}}. Filled from your records: first_name, last_name, full_name, email, phone (the person), animal_name, animal_species, animal_breed, animal_sex, animal_id (the animal’s Pet ID) and org_name. Anything else, such as org_email, org_phone or org_website, is filled only from the variables you send. The message goes out as plain text, and replies to it arrive in your organization’s default inbox.
What stops it, checked in this order, before anything is sent:
- The address is suppressed. An address that hard-bounced is suppressed for every organization and cannot be released; one that complained or unsubscribed is suppressed for your organization only. See Suppressions.
- The person in
person_idhas opted out of email altogether, or out of this message’scategory. See Contact preferences. An address sent without aperson_idis not checked against anybody’s preferences.
A stopped message still answers 201, with status suppressed and the reason in payload_metadata.reason. A copy to a suppressed address is dropped and the rest of the message still goes; the dropped addresses are in payload_metadata.copies_suppressed.
Read status on the answer: sent means the email service accepted it, failed means it did not, which is also the answer while your organization cannot send email, for example while its own domain waits to be verified (each attempt and why it failed is in payload_metadata.failover_attempts), and suppressed means it was stopped. Every one is written to the message log.
Needs write on Communications.
Authorizations
Body
Send person_id or recipient_address, or both.
The body, as plain text.
The record the message is about. An animal or an adoption_application fills the animal merge fields. Kept on the log entry.
Response
The log entry for this message. Read its status: 201 does not by itself mean the email was sent.
suppressed: stopped before sending. sent: the email service accepted it and no delivery report has come back yet. delivered or bounced: what the delivery report said. failed: the email service did not accept it, or reported that it could not deliver it. received: a message that came in. A status never moves back.
queued, sent, delivered, failed, bounced, received, suppressed The record it was about. email_thread for a message sent from a conversation, with the conversation's ID in related_entity_id.

