The esmtp module
Author: Mr. Sam

## The `esmtp` module

- support for delivering and accepting mail via smtp/emstp over TCP/IP.

### Configuration files

`esmtpacceptmailfor,esmtpacceptmailfor.dat` - lists domains whose mail we accept.

`esmtpgreeting` - what smtpd announces as its greeting.

`esmtphelo` - what to announce in my HELO command. Defaults to me.

`esmtppercentrelay.dat` - a GDBM database file. If address `<user%foo@bar>` is given, foo must be in percenthack as the key. Which is then rewritten by smtpd as `<user@val>`, where val is the value of that key in the GDBM file, which can be created by makegdbm.

`esmtproutes` - If the host being delivered to is found in this file, the value will be used instead of looking up MX or A records. The value is a space/tab separated list of IP addresses or hostnames.

`esmtptimeout` - general STMP timeout, in seconds. Both smtpd, and the output module will stop after waiting the specific amount for a response from the remote server.

## Shared library

`rewritedel` - if domain is of the form foo@bar, accept delivery for host bar, user foo@bar.

Rewrite functions:

`esmtp` - compile-time options may be used to specify various kinds of behavior when envelope recipient is being rewritten by submit, including: check for mailbox validity - this involves simply locating any loaded rewritedel function, and failing otherwise (!); or forking and running an external filter!

## Input module

courieresmtpd is typically invoked by couriertcpd to handle incoming connections. courieresmtpd is a full-fledged ESMTP server. courieresmtpd reads ESMTP commands and runs submit to process incoming messages.

courieresmtpd reads BOFHNOEXPN and BOFHNOVRFY environment variables to disable the EXPN and VRFY commands.

## Output module

The output module reads esmtproutes to check for any hardcoded smarthosts.