Objects are declared through the “object” keyword. Two syntax are available. The inline syntax:

object <name> <type> = "<value>";
object my_host ip4 = "";
object local_domain fqdn = "foo.bar";

The extended syntax, allowing the use of user-defined fields:

object <name> <type> = #{
    value: "value",
    <field1>: "value",
    <fieldn>: "value"
object local_mda ip4 = #{
    value: "",
    color: "bbf3ab",
    description: "Internal delivery agent"

✎ | Only the “value:” field is mandatory. The other fields are not.

Type of implemented objects

The following type of objects are supported natively:

stringUntyped valuestringGeneric variable.
ip4IPv4 addressx.y.z.tDecimal values.
ip6IPv6 addressa:b:c:d:e:f:g:hHex values.
rg4IPv4 networkx.y.z.t/rgDecimal values.
rg6IPv6 prefixa:b:c:d:e:f:g:h/rgHex values.
addressEmail addressidentifier@fqdnString.
identifierLocal part of an addressuserString.
fqdnFully qualified domain namemy.domain.comString.
regexRegular expressionPERL regular expression.
groupA group of objectsSee group section.
fileA file of objectsUnix fileSee file section.
codea custom smtp codeSee code section.

About files

File objects are standard Unix text files containing values delimited by CRLF. Only one type of object is authorized and must be declared after the keyword “file:”.

object local_MTA file:ip4 = "/etc/vsmtp/config/local_mta.txt";
cat /etc/vsmtp/config/local_mta.txt

About groups

Groups are collections of objects. They can store references to other objects, store fresh objects or mix any type of object inside.

Unlike objects where fields are declared between parentheses, groups use squared brackets.

object whitelist file:address = "/etc/vsmtp/config/whitelist.txt";

object authorized_users group = [
  object admin address = "admin@mydomain.com",

Groups can be nested into other groups.

object deep_group group = [
  object foo_emails regex = "^[a-z0-9.]+@foo.com$",

✎ | When used with check operators (==, !=, in etc …), the whole group will be tested. The test stops when one of the groups content matches.

About codes

custom codes can be declared with the following syntax.

object code554_7_1 code = #{
  base: 554,
  enhanced: "5.7.1",
  text: "Relay access denied"

// use the code in your rules. deny or send a informational message.

Pre-defined objects

vSL already exposes some objects for you to use. You can check out the Variable file to get documentation on those objects and their use.