Skip to content

halon-extras/emailconsul

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

7 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Email Consul integration

This HSL module can be used to send send email delivery results to Email Consul.

Exported functions

emailconsul_queue($arguments, $connection, $transaction, $id, $recipient, $jobid = none)

This function should be called when queueing the message in the EOD script.

Params

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));
}

emailconsul_delivery($arguments, $message)

This function should be called after every delivery attempt in the Post-delivery script.

Params

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));

emailconsul_async($dsn, $recipient, $dsnrecipient)

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));
        }
    }
}

emailconsul_arf($arf)

This function should be called when receiving a ARF message in the EOD script.

Params

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));
}

Plugin configuration

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.

About

Send email delivery results to Email Consul

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published