Skip to content
Last updated

Parse API: inbound emails

Info

Parse API is available only for users on paid Mailjet plans (Premium 50k and above). Check our plans and pricing pages for more information.

The Parse API allows you to have inbound emails parsed and their content delivered to a webhook of your choice.

It will make the processing of inbound messages easier as Mailjet will do all the job of sifting through and organizing all the information in headers, content and attachments. What's left to do is just to save the information in your CRM or database.

Basic Setup

# Create : ParseRoute description
curl -s \
	-X POST \
	--user "$MJ_APIKEY_PUBLIC:$MJ_APIKEY_PRIVATE" \
	https://api.mailjet.com/v3/REST/parseroute \
	-H 'Content-Type: application/json' \
	-d '{
		"Url":"https://www.mydomain.com/mj_parse.php"
	}'

API Response

{
	"Count": 1,
	"Data": [
		{
			"APIKeyID": "11111111",
			"Email": "16Hy-aOYhApIzTgN@parse-in1.mailjet.com",
			"ID": "1",
			"Url": "https://www.mydomain.com/mj_parse.php"
		}
	],
	"Total": 1
}

In order to begin receiving emails to your webhook, create a new instance of the Parse API via a POST request on the /parseroute resource. This call has only one mandatory property - the Url of the webhook (Note: URLs provided cannot be the root). Mailjet will provide an Email address (on the subdomain @parse-in1.mailjet.com) in the response, you can begin to use immediately. It can be used as a Reply-to Email address for example.

We strongly recommend using a secure (HTTPS) URL in combination with a basic authentification to make sure data cannot be intercepted, and that only our servers can send you data.

E.g.: https://username:password@www.example.com/mailjet_parser.php

You can also specify a port in your webhook URL.

E.g.: https://www.example.com:123/mailjet_triggers.php

Info

Mailjet provides only one Email address (on the subdomain @parse-in1.mailjet.com) per API key.

Parse API also allows you to use your own email address and domain using the Email property in the /parseroute resource. Visit use your own domain section for more information on how to setup your DNS and your parseroute.