post--v3-domain_name-messages
Send emails through Mailgun with customizable recipients, content, attachments, templates, and delivery options for automated messaging.
Instructions
Send an email
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| domain_name | Yes | ||
| from | Yes | Email address of the `From` header. Can include a friendly name using the format `"Friendly Name <email@domain.com>"`. Note: not required if sending with a template that has a pre-set From header, but will override the template's From header if provided. | |
| to | Yes | Email address of the recipient(s). Supports friendly name format. Example: `"Bob <bob@host.com>"`. Use commas to separate multiple recipients. Duplicate addresses are automatically ignored. | |
| cc | No | Same as `to` but for carbon copy recipients. Supports friendly name format. | |
| bcc | No | Same as `to` but for blind carbon copy recipients. Supports friendly name format. | |
| subject | Yes | Message subject. Note: not required if sending with a template that has a pre-set Subject header, but it will override it if provided. | |
| text | No | Body of the message (text version) | |
| html | No | Body of the message (HTML version) | |
| amp-html | No | AMP part of the message. Please follow Google guidelines to compose and send AMP emails | |
| attachment | No | File attachment. You can post multiple `attachment` values. **Important:** You must use `multipart/form-data` encoding for sending attachments | |
| inline | No | Attachment with `inline` disposition. Can be used to send inline images (see example). You can post multiple `inline` values | |
| template | No | Name of a template stored via the Templates API to use to render the email body. See [Templates](https://documentation.mailgun.com/docs/mailgun/user-manual/sending-messages/send-templates) for more information | |
| t_version | No | Render a specific version of the given template instead of the latest version. `template` option must also be provided. | |
| t_text | No | ||
| t_variables | No | A valid JSON-encoded dictionary used as the input for template variable expansion. See [Templates](https://documentation.mailgun.com/docs/mailgun/user-manual/sending-messages/send-templates) for more information | |
| o_tag | No | Tag string. See [Tagging](https://documentation.mailgun.com/docs/mailgun/user-manual/tracking-messages/track-tagging) for more information | |
| o_dkim | No | ||
| o_secondary-dkim | No | Specify a second domain key to sign the email with. The value is formatted as `signing_domain/selector`, e.g. `example.com/s1`. This tells Mailgun to sign the message with the signing domain `example.com` using the selector `s1`. Note: the domain key specified must have been previously created and activated. | |
| o_secondary-dkim-public | No | Specify an alias of the domain key specified in `o:secondary-dkim`. Also formatted as `public_signing_domain/selector`. `o:secondary-dkim` option must also be provided. Mailgun will sign the message with the provided key of the secondary DKIM, but use the public secondary DKIM name and selector. Note: We will perform a DNS check prior to signing the message to ensure the public keys matches the secondary DKIM. | |
| o_deliverytime | No | Specifies the scheduled delivery time in [RFC-2822 format](https://documentation.mailgun.com/docs/mailgun/api-reference/api-overview#date-format). Depending on your plan, you can schedule messages up to 3 or 7 days in advance. If your domain has a custom message_ttl (time-to-live) setting, this value determines the maximum scheduling duration. Example: 'Fri, 14 Oct 2011 12:00:00 +0000' | |
| o_deliver-within | No | Specifies the maximum time window for delivering the message. Accepts values in format `[0-9]+h[0-9]+m` (e.g., `1h30m`, `30m`, `24h`), with a minimum of `5m` and maximum of `24h`. For scheduled messages, the delivery window starts from the scheduled time. The standard retry schedule applies within this window, so shorter timeframes may result in fewer delivery attempts. | |
| o_deliverytime-optimize-period | No | Toggles Send Time Optimization (STO) on a per-message basis. String should be set to the number of hours in `[0-9]+h` format, with the minimum being `24h` and the maximum being `72h`. This value defines the time window in which Mailgun will run the optimization algorithm based on prior engagement data of a given recipient. See [Sending a Message with STO](https://documentation.mailgun.com/docs/mailgun/user-manual/sending-messages/send-sto) for details. *Please note that STO is only available on certain plans. See www.mailgun.com/pricing for more info* | |
| o_time-zone-localize | No | Toggles Timezone Optimization (TZO) on a per message basis. String should be set to preferred delivery time in `HH:mm` or `hh:mmaa` format, where `HH:mm` is used for 24 hour format without AM/PM and hh:mmaa is used for 12 hour format with AM/PM. See [Sending a Message with TZO](https://documentation.mailgun.com/docs/mailgun/user-manual/sending-messages/send-tzo) for details. *Please note that TZO is only available on certain plans. See www.mailgun.com/pricing for more info* | |
| o_testmode | No | ||
| o_tracking | No | ||
| o_tracking-clicks | No | ||
| o_tracking-opens | No | ||
| o_require-tls | No | ||
| o_skip-verification | No | ||
| o_sending-ip | No | Used to specify an IP Address to send an email that is owned by your account | |
| o_sending-ip-pool | No | If an IP Pool ID is provided, the email will be delivered with an IP that belongs in that pool | |
| o_tracking-pixel-location-top | No | ||
| o_archive-to | No | Sends a copy of successfully delivered messages to the specified URL via HTTP POST. The request uses Content-Type: application/mime and contains the exact message the recipient's SMTP server received. NOTE: These are accounted for and billed as delivered messages | |
| o_suppress-headers | No | Removes specified X-Mailgun headers from the delivered message. Provide header names separated by commas (e.g., 'X-Mailgun-Variables,X-Mailgun-Tag') or use 'all' to remove all X-Mailgun headers.Note: X-Mailgun-Sid header is currently used to process complains received via feedback loops. | |
| h_X-My-Header | No | Adds custom headers to the email. Use 'h:' prefix followed by header name and value. Example: 'h:X-Custom-Header=my-value' | |
| v_my-var | No | Attaches custom data to the message using the 'v:' prefix followed by a variable name. When sending with templates, provides values for template variable substitution (overridden by 't:variables' if both are provided). When not using templates, treated as metadata and included in events/webhooks. Variables are visible in the delivered email's X-Mailgun-Variables header. Example: 'v:user-id=123'. NOTE: Anything over 4KB will be truncated in the event/webhooks. | |
| recipient-variables | No | A JSON-encoded dictionary for batch sending with personalized variables per recipient. Each key is a recipient email address, each value is a dictionary of variables for that recipient. Variables can be referenced in the message using %recipient.variablename%. Example: '{"alice@example.com": {"name":"Alice", "id":1}, "bob@example.com": {"name":"Bob", "id":2}}'. Maximum 1,000 recipients per batch. See [Batch Sending](https://documentation.mailgun.com/docs/mailgun/user-manual/sending-messages/batch-sending) for more information |