pipe_transport – Module

March 26, 2020 Contributors

Instead of immediately spooling messages to disk, the pipe_transport I/O module causes them to be piped into a program on the local machine. This module provides a means of running a program whenever there is mail for a specific domain or domains. The success of that program affects the success of the SMTP transaction.

Configuration

The pipe_transport module is configured in your ecelerity.conf file. To load this module, add the following lines to the main body of your ecelerity.conf file:

pipe_transport "pipe_transport1"
{
   program_name  = "/bin/cat"
   output_file = "/var/log/ecelerity/pipe.stdout"
   error_file = "/var/log/ecelerity/pipe.stderr"
   domain =  ( "example.com" "another.example.com" )
   code = [
     "0" = "250 ok"
   ]
}

code

By default, if program_name exits with a "0" exit status it is assumed that the message was delivered correctly, and the SMTP response to the client will be the usual 250 response along with the queue ID. If program_name exits with a non-0 exit status then the pipe is assumed to have failed, and the SMTP response will be set to "504 5.5.0 pipe transport gave exit status %d" where "%d" is replaced by the exit status. If your program_name uses a variety of different exit statuses to inform you of different outcomes you can map them to SMTP response codes. This is used by Unix MTA software. For example read the EXIT CODES portion of this manual page: http://untroubled.org/ezmlm/man/man8/qmail-queue.8.html. If program_name has a set of defined exit codes you can map them to meaningful SMTP response codes. So for qmail-command, 100 would equate to a 550 code because it indicates a hard error, but 111 should be a 450 code because it indicates a soft error. You might want to indicate this in the following way:

code = [
        100 = "550 command failed"
        111 = "450 try again later"
]
domain

This option determines which domains should be piped through the module.

error_file

This option determines the error file. If the error_file is omitted, it is assumed to be /dev/null.

output_file

This option determines the output file. If the output_file is omitted, it is assumed to be /dev/null.

program_name

This option configures the program that will be used.