Mailjet provides a way to receive email, in addition to sending them. To achieve that, you should start creating a parseroute which maps a given email address to your webhook.
For testing purposes, Mailjet provides auto generated email addresses on the domain parse-in1.mailjet.com.
For production setup, we however recommend you to setup the Parse API with your own domain, as explained below.
Maps to /inbound/domains.json
In Mailjet API, Inbound Domains are called parseroute
Maps to /inbound/add-domain.json
Adding a domain is done through the sender resource.
Domain verification is tied to the sender resource.
Please refer to the Senders calls guide to learn more.
Maps to /inbound/delete-domain.json
<?php
require 'vendor/autoload.php';
use \Mailjet\Resources;
$mj = new \Mailjet\Client(getenv('MJ_APIKEY_PUBLIC'), getenv('MJ_APIKEY_PRIVATE'));
$response = $mj->delete(Resources::$Sender, ['id' => $id]);
$response->success() && var_dump($response->getData());
?>Issue a DELETE request on the sender resource to set its status to Deleted
Inbound routes are called parseroute in the Mailjet API.
Maps to /inbound/add-route.json
<?php
require 'vendor/autoload.php';
use \Mailjet\Resources;
$mj = new \Mailjet\Client(getenv('MJ_APIKEY_PUBLIC'), getenv('MJ_APIKEY_PRIVATE'));
$body = [
'APIKeyID' => "",
'Email' => "miss@mailjet.com",
'Url' => ""
];
$response = $mj->post(Resources::$Parseroute, ['body' => $body]);
$response->success() && var_dump($response->getData());
?>{
"Count": 1,
"Data": [
{
"APIKeyID": "",
"Email": "miss@mailjet.com",
"ID": "",
"Url": ""
}
],
"Total": 1
}In order to create a new parseroute, issue a POST request.
Maps to /inbound/update-route.json
<?php
require 'vendor/autoload.php';
use \Mailjet\Resources;
$mj = new \Mailjet\Client(getenv('MJ_APIKEY_PUBLIC'), getenv('MJ_APIKEY_PRIVATE'));
$body = [
'APIKeyID' => "",
'Url' => ""
];
$response = $mj->put(Resources::$Parseroute, ['id' => $id, 'body' => $body]);
$response->success() && var_dump($response->getData());
?>{
"Count": 1,
"Data": [
{
"APIKeyID": "",
"Email": "miss@mailjet.com",
"ID": "",
"Url": ""
}
],
"Total": 1
}In order to update parseroute, issue a PUT request with its given ID.
Maps to /inbound/delete-route.json
<?php
require 'vendor/autoload.php';
use \Mailjet\Resources;
$mj = new \Mailjet\Client(getenv('MJ_APIKEY_PUBLIC'), getenv('MJ_APIKEY_PRIVATE'));
$response = $mj->delete(Resources::$Parseroute, ['id' => $id]);
$response->success() && var_dump($response->getData());
?>In order to delete parseroute, issue a DELETE request with its given ID.