Skip to main content

In-line delivery

The Halon MTA is capable of doing queue-less, inline delivery resulting in

  • Fully fail-safe, fault-tolerant SMTP transactions
  • Fully elimination of backscatter problems
  • Fully transferring the responsibility of error reporting and queuing to the sender

This feature allows the system to fail (hardware failure, etc) at any moment during operation without the risk of loosing any data. Messages are not accepted (220 OK) until the message is accepted by the receiving backend mail server. This is only suitable for inbound processing; outbound delivery (sending) email should always use the queue, preferably using queue policies creating virtual queues.

Enabling in-line delivery

In the end-of-DATA script you get the delivery results, which enables you to implement logging. Please see the example below.

EOD context
$r = $arguments["mail"]->send(
$transaction["senderaddress"],
array_map(function ($r) { return $r["address"]; }, $transaction["recipients"]),
["host" => "mail.example.com", "tls" => "optional"]);

if (isset($r["result"])) {
$result = $r["result"];
$codes = [];
if ($result["state"] == "EOD")
$codes = ["reply_codes" => ["code" => $result["code"], "enhanced" => $result["enhanced"]]];
if ($result["code"] >= 200 and $result["code"] <= 299)
Accept($result["reason"], $codes);
if ($result["code"] >= 500 and $result["code"] <= 599)
Reject($result["reason"], $codes);
Defer($result["reason"], $codes);
} else {
$error = $r["error"];
if (!$error["temporary"])
Reject($error["message"]);
Defer($error["message"]);
}

The feature has a few defined limitations, in order to prevent odd behaviours such as message duplication and unknown message delivery statuses on multiple recipients. These limitations usually cause an runtime exception, and include:

  • Delivery has to be made to a single backend server (it cannot operate in lookup-mx/outbound mode)
  • Per-recipient modification to a single message cannot be done
  • If one recipient fails (because of the backend server), the message will not be delivered (solved by enabling recipient filtering in the RCPT TO context).