SMTP Listener

SMTP Listener is a command-line SMTP server (only the receiver, without sending part). It may be useful for test purposes, handle bounce emails, etc.

Supported OS: Windows XP, Windows Vista, Windows 7, Windows 8.

Implemented SMTP commands (look RFC 821):
  • HELO

  • EHLO

  • MAIL

  • RCPT

  • DATA

  • RSET

  • NOOP

  • QUIT

Installation

To install SMTP Listener just unzip smtplisten.zip somewhere on your hard drive.

Usage

SMTPListen.exe [-logfile filename] [cfgfile smtplstn.ini]

Optional command-line parameters:

-logfile filename

It allows to specify log filename. Default output: to screen.

-cfgfile smtplstn.ini

The path to the configuration file (see Configuration section below). Default configuration file name: smtplstn.ini.

Configuration

The format for an entry in the configuration file is Option=Value. Entries in the configuration file can appear in any order.

All of the possible entries in the configuration file are listed below.

Log

Would you like to save the log to file. Possible values: Yes, No, Overwrite. Default: No.

ListenPort

Listen incoming connections on this port. Example:

ListenPort=25

ListenIP

Listen incoming connections on this ip (network interface). Example:

ListeIP=192.168.0.1

SrvIPv6

Force using IPv6 protocol for incoming connections. Default: No. Example:

SrvIPv6=Yes

SMTPMaxSessions

Maximum number of concurrent SMTP sessions. Default: 100. Maximum: 1000. Example:

SMTPMaxSessions=100

SMTPMaxErrors

Maximum number of errors; connection will be terminated after reaching this limit. Default: 10. Example:

SMTPMaxErrors=10

SMTPMaxHelos

Maximum number of HELO/EHLO commands; connection will be terminated after reaching this limit. Default: 10. Example:

SMTPMaxHelos=10

SMTPMaxMails

Maximum number of MAIL commands; connection will be terminated after reaching this limit. Default: 100. Example:

SMTPMaxMails=100

SMTPMaxRsets

Maximum number of RSET commands; connection will be terminated after reaching this limit. Default: 100. Example:

SMTPMaxRsets=100

SMTPMaxNoops

Maximum number of NOOP commands; connection will be terminated after reaching this limit. Default: 10. Example:

SMTPMaxNoops=10

SMTPMaxDataSize

Maximum size of the message. Default: 35882577. Example:

SMTPMaxDataSize=3000000

SMTPServiceName

Name of the SMTP service (it appears in SMTP greeting). Can’t be empty. Default: SMTPListen. Example:

SMTPServiceName=ESMTP

SMTPHostName

Host name used for SMTP greeting. Can’t be empty. Default: localhost. Example:

SMTPHostName=example.com

SMTPGreeting

SMTP greeting. Can’t be empty. You can use tags: {%SMTP_HOST%} (it matches to the SMTPHostName setting) and {%SMTP_SERVICE%} (it matches to the SMTPServiceName setting). Default: {%SMTP_HOST%} {%SMTP_SERVICE%} ready. Example:

SMTPGreeting={%SMTP_HOST%} {%SMTP_SERVICE%} ready

MessagesDir

Store incoming messages to this folder. Don’t store messages if this setting is empty or ommited. Example:

MessagesDir=c:\temp\messages

AddReturnPathHeader

Add Return-Path header to the stored messages (address from the MAIL command). Possible values: Yes (default), No. Example:

AddReturnPathHeader=Yes

Example of the Return-Path header:

Return-Path: <user@test.com>

AddReceivedHeader

Add Recevied header to the stored messages. Possible values: Yes (default), No. Example:

AddReceivedHeader=Yes

Example of the Received header:

Received: from localhost ([127.0.0.1])
  by example.com with SMTPListen
  for <user@domain.com>;
  Fri, 04 Apr 2014 12:49:32 +0600

AllowedDomains

The list of the allowed domains (accepted domains in RCPT command). Example:

AllowedDomains=example.com,domain.com

AllowedFile

Load the list of the allowed domains from file. Example:

AllowedFile=c:\temp\alloweddomains.txt

AllowedUrl

Load the list of the allowed domains from URL. Example:

AllowedUrl=http://127.0.0.1/alloweddomains.php

AllowedUrlX

X is a number between 1 and 9. This option allows to set up to 9 allowed domains URLs. Example:

AllowedUrl1=http://127.0.0.1/alloweddomains1.php
AllowedUrl2=http://127.0.0.1/alloweddomains2.php
AllowedUrl3=http://127.0.0.1/alloweddomains3.php

ReloadSeconds

Reload allowed domains every X seconds. Default: 0 - don’t reload. Example:

ReloadSeconds=60

AllowFrom

The list of IP addresses that are allowed access. Example:

AllowFrom=127.0.0.1,192.168.0.1

You can specify the range of allowed IP addresses using CIDR, for example: 127.0.0.0/24

AllowFromFile

Read the list of allowed IP addresses/ranges from file. Example:

AllowFromFile=allowfrom.txt

DenyFrom

The list of IP addresses that are denied access. Example:

DenyFrom=10.10.8.8,10.10.8.9

You can specify the range of denied IP addresses using CIDR, for example: 10.0.0.0/8

DenyFromFile

Read the list of denied IP addresses/ranges from file. Example:

DenyFromFile=denyfrom.txt

AllowDenyOrder

Tells SMTP Listener the order of processing AllowFrom and DenyFrom rules.

Possible values are:

  • Deny,Allow - if the client does not match DenyFrom rule or it does match AllowFrom rule, then it will be granted access. This is the default order.

  • Allow,Deny - if the client does not match AllowFrom rule or it does match DenyFrom rule, then the client will be denied access.

Example:

AllowDenyOrder=Deny,Allow

DNSHost

The host (IP) of the primary DNS server. Example:

DNSHost=8.8.8.8

DNSHost2

The host (IP) of the secondary DNS server. Example:

DNSHost2=8.8.4.4

DNSPort

The port number of the primary DNS server. Default: 53. Example:

DNSPort=53

DNSPort2

The port number of the secondary DNS server. Default: 53. Example:

DNSPort2=53

DNSTimeout

DNS query timeout (seconds). Default: 10. Example:

DNSTimeout=5

DNSCacheTTL

“Time to live” (in seconds) of the internal DNS records cache. Default: 0 (don’t use DNS cache). Example:

DNSCacheTTL=10

DNSDomainsFile

The path to the list of domain zones (Domains File). Each line in the Domains File contains zone name and the path to the Zone File ( http://en.wikipedia.org/wiki/Zone_file ), delimited by comma, semicolon or equal sign. Path to the Zone File can be enclosed in quotes. It can be absolute path or the path relative to the directory where Domains File resides.

Example:

DNSDomainsFile=c:\temp\dns\domains.txt