Suggested filters
keyword:keyword:setup
results for a specific keyword
question:question:how do I get started?
AI will suggest the best answer
Dashboard
Edit Article Logout

Send Email


API Query Parameters

The API accepts either a single dsid (DailyStory unique id) or a comma separated list of email addresses. If email query string parameter has a value, the dsid value will be ignored.

  • email - The email parameter accepts a single example address, e.g. email=person@example.com, or a comma separate list of email addresses, e.g. email=person1@example.com,person2@example.com
Important

If both the email address and the dsid parameter is sent, the implied intent is that the email address is preferred and the dsid is a fallback.

Any email addresses that are invalid or are attempted to be used for invalid contacts will be ignored.

JSON Body

Optionally include a JSON body with properties used to personalize the email.

{ "subject":"My new email subject", // optional to set a subject "from":"hello@example.com", // optional set a from address "confirmation_url":"https://example.com", // optional set a profile field "confirmation_code":"confirmation-38474" // optional set a profile field }

These fields are then accessible in the email. The following fields are reserved field and for a templated email that is sent these fields are usually already set.

  • subject - set an alternate subject for the email.
  • from - set an alternate from address for the email.
  • preheader- set an alternate preheader for the email.
  • plaintext- set an alternate plaintext for the email.
  • cc - carbon copy recipients. Must be in standard email format. Multiple addresses should be separated with a semi-colon.
  • bcc - blind carbon copy recipient. Must be in standard email format. Multiple addresses should be separated with a semi-colon.
  • reply-to - set the reply-to header of the email. Must be in standard email format. Only a single address is allowed.

For example:

Hello, your confirmation code is{{profile.confirmation_code}}.

It's also possible to send a subject or from with a personalization token, for example:

{ "subject":"Your id is {{@profile.custom_id}}" }

When the email is sent if the contact has a personalization field of custom_id it will automatically be inserted.  

Path Parameters
idnumberrequired
Id of the email to send.
Query Parameters
dsidstring
The dsid of a single contact to send to. Ignored if email is also provided.
emailstring
A single email address or a comma-separated list of email addresses. When provided, dsid is ignored and each address is resolved to (or created as) a contact.
HTTP Request Examples
{ "subject":"My new email subject", "from":"hello@example.com", "confirmation_url":"https://example.com", "confirmation_code":"confirmation-38474" }
HTTP Request Parameters
subject, from, preheader, plaintext, cc, bcc, reply-tostring
Optional per-send overrides for the corresponding email header fields.
attachmentsstring
Optional base64-encoded JSON map of filename β†’ base64-encoded file bytes. See Including Attachments for the encoding recipe.
(custom personalization fields)string
Any other JSON body keys are merged onto the contact's lead as extended properties and become available as {{profile.}} personalization tokens within the email body, subject, or from address.
HTTP Response Examples
200Single recipient
{ "Status": true, "Message": "Email sent", "Response": { "messageid": "20231127164859.ee81700d9b371f25@mg.dailystory.net" } }
200Multiple recipients (email=a@x.com,b@x.com)
{ "Status": true, "Message": "Email sent", "Response": { "messageid": [ "20231127164859.ee81700d9b371f25@mg.dailystory.net", "20231127164859.aa42199b0ed42c11@mg.dailystory.net" ] } }
HTTP Response Parameters
messageidstring | array
The Mailgun message id of the sent email. When sending to a single recipient this is a string; when sending to a comma-separated list of emails it is an array of message ids, one per successful send (individual failures are silently skipped).

How helpful was this article?

πŸ‘ or πŸ‘Ž

Related Articles

Markdown Version