---
title: How to implement SMTP LANG with proxy script for email delivery
description: Learn how to implement SMTP LANG with a proxy script to improve email management and optimize delivery efficiency.
---

[News | Halon ](https://halon.io/blog)

# [How to implement SMTP LANG with proxy script for email delivery](https://halon.io/blog/implementing-smtp-lang-with-proxy-script)

 Written by [Anders Berggren](https://halon.io/blog/author/anders-berggren) | Mar 31, 2019 10:00:00 PM

The upcoming Halon 5.1 release introduces a new SMTP server [proxy](https://docs.halon.io/hsl/archive/master/proxy.html) script. It’s configured to be executed before specific (or all) SMTP commands, even command which isn’t recognised by the SMTP server. In this blog we’ll describe how to implement our proposed [SMTP LANG](https://halon.io/blog/smtp-lang-extension/) extension using this new script hook. First of all, we announce the LANG extension and the languages supported in the HELO script:

```
$announce =  [...$arguments["extensions"], "LANG SE"];
Accept(["extensions" => $announce]);
```

Next, we configure to proxy script to hook onto the new “BREV”, “INNEHÅLL” and “HEJDÅ” commands:

Finally, we setup the proxy script to translate the international (Swedish, in this case) commands with their standard SMTP respective:

```
$cmd = str_upper($arguments["command"]);
if ($cmd[0:11] == "BREV FRÅN:") { // MAIL FROM
    $realcmd = "MAIL FROM:" + $arguments["command"][11:];
    Pass(["command" => $realcmd]);
}
if ($cmd == "HEJDÅ") { // QUIT
    $codes = ["code" => 221, "enhanced" => [2, 0, 0]];
    Reply("Ha det bra", ["reply_codes" => $codes, "disconnect" => true]);
}
// etc...
```

The proxy script and the corresponding [xtext](https://docs.halon.io/hsl/archive/master/functions.html#xtext_encode) functions can be used for many other things, like custom XCLIENT implementations. More information on the 5.1 will be released later this month.

[View full post](https://halon.io/blog/implementing-smtp-lang-with-proxy-script)

```json
{
  "@context" : "http://schema.org",
  "@type" : "BlogPosting",
  "author" : {
    "@type" : "Person",
    "name" : "Anders Berggren"
  },
  "dateModified" : "2024-12-24T08:08:10.290Z",
  "datePublished" : "2019-03-31T22:00:00Z",
  "headline" : "Implementing SMTP LANG with proxy script",
  "image" : {
    "@type" : "ImageObject",
    "height" : 317,
    "url" : "https://2734201.fs1.hubspotusercontent-na1.net/hubfs/2734201/Imported_Blog_Media/smtp-lang-extension-1.png",
    "width" : 1000
  },
  "mainEntityOfPage" : "https://halon.io/blog/implementing-smtp-lang-with-proxy-script",
  "publisher" : {
    "@type" : "Organization",
    "logo" : {
      "@type" : "ImageObject",
      "height" : 60,
      "url" : "/hs/hsstatic/content_shared_assets/static-1.4092/img/default-amp-logo.png",
      "width" : 60
    },
    "name" : "Halon blog"
  }
}
```