This HSL module can be used to send send email delivery results to Email Consul.
This function should be called when queueing the message in the EOD script.
Params
$arguments
The pre-defined$arguments
variable$connection
The pre-defined$connection
variable$transaction
The pre-defined$transaction
variable$id
The id of the queued message$recipient
The recipient of the queued message$jobid
The job id of the queued message
Returns
The queue event as an associative array.
Example
import { emailconsul_queue } from "modules/emailconsul";
// Queue message for all recipients
foreach ($transaction["recipients"] as $recipient) {
$id = $mail->queue($transaction["sender"], $recipient["address"], $recipient["transportid"]);
$emailconsul = emailconsul_queue($arguments, $connection, $transaction, $id, $recipient);
http_bulk("emailconsul", json_encode($emailconsul));
}
This function should be called after every delivery attempt in the Post-delivery script.
Params
$arguments
The pre-defined$arguments
variable$message
The pre-defined$message
variable
Returns
The delivery event as an associative array.
Example
import { emailconsul_delivery } from "modules/emailconsul";
$emailconsul = emailconsul_delivery($arguments, $message);
http_bulk("emailconsul", json_encode($emailconsul));
This function should be called when receiving a DSN message in the EOD script.
Params
$dsn
The parsed dsn message$recipient
The recipient of the message$dsnrecipient
The recipient inside the parsed dsn message
Returns
The async delivery event as an associative array.
Example
import { dsn_parse } from "extras://dsn";
import { emailconsul_async } from from "modules/emailconsul";
$dsn = dsn_parse($arguments["mail"]);
if ($dsn) {
foreach ($transaction["recipients"] as $recipient) {
foreach ($dsn["recipients"] as $dsnrecipient) {
$emailconsul = emailconsul_async($dsn, $recipient, $dsnrecipient);
http_bulk("emailconsul", json_encode($emailconsul));
}
}
}
This function should be called when receiving a ARF message in the EOD script.
Params
$arf
The parsed arf report
Returns
The feedback loop event as an associative array.
Example
import { arf_parse } from "extras://arf";
import { emailconsul_arf } from "modules/emailconsul";
$arf = arf_parse($arguments["mail"]);
if ($arf) {
$emailconsul = emailconsul_arf($arf);
http_bulk("emailconsul", json_encode($emailconsul));
}
This HSL module requires that the http-bulk plugin is installed.
plugins:
- id: http-bulk
config:
queues:
- id: emailconsul
path: /var/run/emailconsul.jlog
format: jsonarray
url: https://api.dev.emailconsul.com/halon/<customerID>
min_items: 500
max_items: 500
max_interval: 60
headers:
- "X-API-Key: <apiKey>"
You need to replace <customerID>
and <apiKey>
with your own values.