## NAME

smtp-sink - multi-threaded SMTP/LMTP test server

## SYNOPSIS

smtp-sink [options] [inet:][host]:port backlog

smtp-sink [options] unix:pathname backlog

## DESCRIPTION

smtp-sink listens on the named host (or address) and port. It takes SMTP messages from the network and throws them away. The purpose is to measure client performance, not protocol compliance.

smtp-sink may also be configured to capture each mail delivery transaction to file. Since disk latencies are large compared to network delays, this mode of operation can reduce the maximal performance by several orders of magnitude.

Connections can be accepted on IPv4 or IPv6 endpoints, or on UNIX-domain sockets. IPv4 and IPv6 are the default. This program is the complement of the smtp-source(1) program.

Note: this is an unsupported test program. No attempt is made to maintain compatibility between successive versions.

Arguments:

\fB-4\fR

Support IPv4 only. This option has no effect when Postfix is built without IPv6 support.

\fB-6\fR

Support IPv6 only. This option is not available when Postfix is built without IPv6 support.

\fB-8\fR

Do not announce 8BITMIME support.

\fB-a\fR

Do not announce SASL authentication support.

\fB-A \fIdelay\fR

Wait delay seconds after responding to DATA, then abort prematurely with a 550 reply status. Do not read further input from the client; this is an attempt to block the client before it sends ".". Specify a zero delay value to abort immediately.

\fB-b \fIsoft-bounce-reply\fR

Use soft-bounce-reply for soft reject responses. The default reply is "450 4.3.0 Error: command failed".

\fB-B \fIhard-bounce-reply\fR

Use hard-bounce-reply for hard reject responses. The default reply is "500 5.3.0 Error: command failed".

\fB-c\fR

Display running counters that are updated whenever an SMTP session ends, a QUIT command is executed, or when "." is received.

\fB-C\fR

Disable XCLIENT support.

\fB-d \fIdump-template\fR

Dump each mail transaction to a single-message file whose name is created by expanding the dump-template via strftime(3) and appending a pseudo-random hexadecimal number (example: "%Y%m%d%H/%M." expands into "2006081203/05.809a62e3"). If the template contains "/" characters, missing directories are created automatically. The message dump format is described below.

Note: this option keeps one capture file open for every mail transaction in progress.

\fB-D \fIdump-template\fR

Append mail transactions to a multi-message dump file whose name is created by expanding the dump-template via strftime(3). If the template contains "/" characters, missing directories are created automatically. The message dump format is described below.

Note: this option keeps one capture file open for every mail transaction in progress.

\fB-e\fR

Do not announce ESMTP support.

\fB-E\fR

Do not announce ENHANCEDSTATUSCODES support.

\fB-f \fIcommand,command,...\fR

Reject the specified commands with a hard (5xx) error code. This option implies -p.

Examples of commands are CONNECT, HELO, EHLO, LHLO, MAIL, RCPT, VRFY, DATA, ., RSET, NOOP, and QUIT. Separate command names by white space or commas, and use quotes to protect white space from the shell. Command names are case-insensitive.

\fB-F\fR

Disable XFORWARD support.

\fB-h\fI hostname\fR

Use hostname in the SMTP greeting, in the HELO response, and in the EHLO response. The default hostname is "smtp-sink".

\fB-L\fR

Enable LMTP instead of SMTP.

\fB-m \fIcount\fR (default: 256)

An upper bound on the maximal number of simultaneous connections that smtp-sink will handle. This prevents the process from running out of file descriptors. Excess connections will stay queued in the TCP/IP stack.

\fB-M \fIcount\fR

Terminate after receiving count messages.

\fB-n \fIcount\fR

Terminate after count sessions.

\fB-p\fR

Do not announce support for ESMTP command pipelining.

\fB-P\fR

Change the server greeting so that it appears to come through a CISCO PIX system. Implies -e.

\fB-q \fIcommand,command,...\fR

Disconnect (without replying) after receiving one of the specified commands.

Examples of commands are CONNECT, HELO, EHLO, LHLO, MAIL, RCPT, VRFY, DATA, ., RSET, NOOP, and QUIT. Separate command names by white space or commas, and use quotes to protect white space from the shell. Command names are case-insensitive.

\fB-Q \fIcommand,command,...\fR

Send a 421 reply and disconnect after receiving one of the specified commands.

Examples of commands are CONNECT, HELO, EHLO, LHLO, MAIL, RCPT, VRFY, DATA, ., RSET, NOOP, and QUIT. Separate command names by white space or commas, and use quotes to protect white space from the shell. Command names are case-insensitive.

\fB-r \fIcommand,command,...\fR

Reject the specified commands with a soft (4xx) error code. This option implies -p.

Examples of commands are CONNECT, HELO, EHLO, LHLO, MAIL, RCPT, VRFY, DATA, ., RSET, NOOP, and QUIT. Separate command names by white space or commas, and use quotes to protect white space from the shell. Command names are case-insensitive.

\fB-R \fIroot-directory\fR

Change the process root directory to the specified location. This option requires super-user privileges. See also the -u option.

\fB-s \fIcommand,command,...\fR

Log the named commands to syslogd.

Examples of commands are CONNECT, HELO, EHLO, LHLO, MAIL, RCPT, VRFY, DATA, ., RSET, NOOP, and QUIT. Separate command names by white space or commas, and use quotes to protect white space from the shell. Command names are case-insensitive.

\fB-S start-string\fR

An optional string that is prepended to each message that is written to a dump file (see the dump file format description below). The following C escape sequences are supported: ea (bell), eb (backslace), ef (formfeed), en (newline), er (carriage return), et (horizontal tab), ev (vertical tab), eddd (up to three octal digits) and ee (the backslash character).

\fB-t \fItimeout\fR (default: 100)

Limit the time for receiving a command or sending a response. The time limit is specified in seconds.

\fB-T \fIwindowsize\fR

Override the default TCP window size. To work around broken TCP window scaling implementations, specify a value > 0 and < 65536.

\fB-u \fIusername\fR

Switch to the specified user privileges after opening the network socket and optionally changing the process root directory. This option is required when the process runs with super-user privileges. See also the -R option.

\fB-v\fR

Show the SMTP conversations.

\fB-w \fIdelay\fR

Wait delay seconds before responding to a DATA command.

\fB-W \fIcommand:delay[:odds]\fR

Wait delay seconds before responding to command. If odds is also specified (a number between 1-99 inclusive), wait for a random multiple of delay. The random multiplier is equal to the number of times the program needs to roll a dice with a range of 0..99 inclusive, before the dice produces a result greater than or equal to odds.

[\fBinet:\fR][\fIhost\fR]:\fIport\fR

Listen on network interface host (default: any interface) TCP port port. Both host and port may be specified in numeric or symbolic form.

\fBunix:\fR\fIpathname\fR

Listen on the UNIX-domain socket at pathname.

\fIbacklog\fR

The maximum length the queue of pending connections, as defined by the listen(2) system call.

## DUMP FILE FORMAT

Each dumped message contains a sequence of text lines, terminated with the newline character. The sequence of information is as follows:

\(bu

The optional string specified with the -S option.

\(bu

The smtp-sink generated headers as documented below.

\(bu

The message header and body as received from the SMTP client.

\(bu

An empty line.

The format of the smtp-sink generated headers is as follows:

\fBX-Client-Addr: \fItext\fR

The client IP address without enclosing []. An IPv6 address is prefixed with "ipv6:". This record is always present.

\fBX-Client-Proto: \fItext\fR

The client protocol: SMTP, ESMTP or LMTP. This record is always present.

\fBX-Helo-Args: \fItext\fR

The arguments of the last HELO or EHLO command before this mail delivery transaction. This record is present only if the client sent a recognizable HELO or EHLO command before the DATA command.

\fBX-Mail-Args: \fItext\fR

The arguments of the MAIL command that started this mail delivery transaction. This record is present exactly once.

\fBX-Rcpt-Args: \fItext\fR

The arguments of an RCPT command within this mail delivery transaction. There is one record for each RCPT command, and they are in the order as sent by the client.

\fBReceived: \fItext\fR

A message header for compatibility with mail processing software. This three-line header marks the end of the headers provided by smtp-sink, and is formatted as follows:

\fBfrom \fIhelo\fB ([\fIaddr\fB])\fR

The HELO or EHLO command argument and client IP address. If the client did not send HELO or EHLO, the client IP address is used instead.

\fBby \fIhost\fB (smtp-sink) with \fIproto\fB id \fIrandom\fB;\fR

The hostname specified with the -h option, the client protocol (see X-Client-Proto above), and the pseudo-random portion of the per-message capture file name.

\fItime-stamp\fR

A time stamp as defined in RFC 2822.

## SEE ALSO

    smtp-source(1), SMTP/LMTP message generator

## LICENSE

The Secure Mailer license must be distributed with this software.

## AUTHOR(S)

    Wietse Venema
    IBM T.J. Watson Research
    P.O. Box 704
    Yorktown Heights, NY 10598, USA