fn connect

fn connect(parameters: Map) -> Smtp
Connect to a third party software that accepts SMTP transactions. This module is used with the `delegate` keyword.
  • parameters - a map of the following parameters:
    • delegator - a map of the following parameters.
      • address - the address to connect to the third-party software
      • timeout - timeout between each SMTP commands. (optional, default: 30s)
    • receiver - the socket to get back the result from.

A service used to delegate a message.

  • The service failed to parse the command parameters.
  • The service failed to connect to the delegator address.
// declared in /etc/vsmtp/services/smtp.vsl
export const clamsmtpd = smtp::connect(#{
    delegator: #{
        // The service address to delegate to.
        address: "",
        // The time allowed between each message before timeout.
        timeout: "2s",
    // The address where vsmtp will gather the results of the delegation.
    // The third party software should be configured to send the email back at this address.
    receiver: "",

The service is then used in a rule file using the following syntax:

import "service/smtp" as srv;

    postq: [
        // this will delegate the email using the `clamsmtpd` service.
        delegate srv::clamsmtpd "delegate antivirus processing" || {
            // this is executed after the delegation results have been
            // received on port 10024.