Transactional emails
Using /api/transactional-mails/send
endpoint, you can send a transactional email.
$ MAILCOACH_TOKEN="your API token" $ curl -X POST https://<your-mailcoach-domain>/api/transactional-mails/send \ -H "Authorization: Bearer $MAILCOACH_TOKEN" \ -H 'Accept: application/json' \ -H 'Content-Type: application/json' \ -d '{"mail_name":"name-of-the-mail", "subject": "Subject of your email", ...}'
These are the parameters you should give to this call:
-
mail_name
: the name of the transactional email as specified on the email’s screen. This is required if you don’t sendhtml
. -
html
: if you want to use a transactional email (as defined on the email screen), you can provide HTML that will be used as the body of your email. -
subject
: the subject used for the transactional email -
from
: the from address that will be used. -
to
: the to address to use. You can specify multiple addresses comma-delimited. -
cc
: the cc address to use. You can specify multiple addresses comma-delimited. -
bcc
: the bcc address to use. You can specify multiple addresses comma-delimited. -
store
: defaults totrue
; when set to false, the transactional email will not be added to the transactional email log. -
mailer
: the name of the mailer to use to send the email. If not set, we’ll use the default of your account. -
replacements
: a key-value array that will be used to fill all replacers in your mail. These will only be used if you also specifyname
. -
fake
: a boolean that determines if Mailcoach should actually send the email or just log it in the interface. This way you can use Mailcoach as a Mailtrap or Mailhog replacement