Skip to content

Latest commit

 

History

History
65 lines (55 loc) · 2.18 KB

mailjet.md

File metadata and controls

65 lines (55 loc) · 2.18 KB

Mailjet

Setup

You will need your API key and your secret key from your mailjet account.

In your settings.json file, you'll need to add the following configuration object to the actions property:

"actions": {
  "mailjet": {
    "apiKey": "xxxxxxx",
    "secretKey": "xxxxxxxx",
    "fromEmail": "your@e.mail",
		"templateID": "xxxx"
  }
}

Usage

You can send emails by sending a POST request to this action :

Note: If you want to attach files to your email, you have to send your request using form-data. The files' total size must not exceed 15MB

curl -X POST -H "Content-Type: multipart/form-data; boundary=----xxxxxxxxxxxxxxxxxx"
-F "media=@your.file"
-F "fromEmail=your@email.net"
-F "recipients=[ { "Email": "first@mail.fr", "Name": "Name1" }, { "Email": "second@mail.com" } ]"
-F "subject=Sending attached file to multiple adresses"
-F "textPart=This is the simple text part."
-F "htmlPart=<h3>This is the html part</h3>"
"http://localhost:6060/api/v1/actions/mailjet"
curl -X POST -H "Content-Type: application/json" -d '{
	"fromEmail": "your@email.org",
	"recipients": [
		{"Email": "first@mail", "Name": "Foo"},
		{"Email": "second@mail"}
	],
	"subject": "Mail using template",
	"textPart": "I will be overriden by the template.",
	"htmlPart": "I will also be overriden by the template",
	"templateID": "00000",
	"vars": {
		"foo": "this is a variable for the template"
	}
}' "http://localhost:6060/api/v1/actions/mailjet"

Options

name type required description
fromEmail string × adress the email is sent from
recipients string × array of adresses to send the mail to (JSON formatted string)
subject string × the mail's subject
textPart string if no htmlPart and no templateID text version of the mail
htmlPart string if no textPart and no templateID html version of the mail
templateID string if no textPart and no htmlPart id of the template to use
vars string object containing variables for the template(JSON formatted string)
media file file to attach to your mail. name doesn't matter. multiple files possible