Specify the configuration directory for SMTPGATE,
a SMTP to {SMTP,NNTP} gateway.
To accept and relay SMTP messages bound to
"recipient@the-host-of-DeleGate",
create a configuration directory at
"SMTPGATE/users/recipient"
for each recipient,
to hold files for configuration, log, counter, and spool.
Then create a configuration file named "SMTPGATE/users/recipient/conf".
Example: SMTP to SMTP forwarding
// forward messages accepted at "feedback@delegate.org"
// toward "delegate-en@smtpgate.etl.go.jp"
delegate.org# delegated -P25 SERVER=smtp
[the contents of SMTPGATE/users/feedback/conf]
INHERIT: sendmail
SERVER-HOST: mail.etl.go.jp
RECIPIENT: delegate-en@smtpgate.etl.go.jp
ACCEPT/From: !%, !MAILER_DAEMON@, !hotmail.com, ...
Example: SMTP to NNTP forwarding
[the contents of SMTPGATE/users/feedback/conf]
INHERIT: postnews
SERVER-HOST: news.delegate.org
OUTPUT/Newsgroups: mail-lists.delegate-en
OUTPUT/Distribution: world
OUTPUT/Reply-To: feedback@delegate.org
OUTPUT/Subject: [DeleGate-En] ${subject:hc}
OUTPUT/Header: X-Seqno: ${seqno}
OUTPUT/Header: UNIX-From: ${unixfrom}
CONTROL/Errors-To: mladmin@delegate.org
ACCEPT/User-Text: delegate ## reject if a word "delegate" is not in body
ACCEPT/Max-Bytes: 50000 ## reject larger 50KB header+body
ACCEPT/Min-Body-Bytes: 64 ## reject smaller 64B body
OPTION: isn,rni,res,reb
A SMTPGATE configuration file consists of a series of lines
of directives,
each looks like a message header of the internet message.
Comment string after sharp (#) character in each line is ignored.
Directives are categorized into three groups;
CONTROL, ACCEPT and OUTPUT.
- CONTROL
-
Specify the function of the gateway, the destination server,
and the destination address in the envelope.
Note that you can inherit a configuration from another recipient
as well as "sendmail" and "postnews" in the INHERIT directive.
- INHERIT: {sendmail | postnews | recipient}
- SERVER-HOST: host
- SERVER-PORT: portNumber
- RECIPIENT: EmailAddressForm (used with "sendmail")
- CONTROL/SENDER: EmailAddressForm (envelope's From in SMTP)
- CONTROL/BCC: EmailAddressForm (a copy is sent to the address on success)
- CONTROL/Errors-To: EmailAddress (a copy is sent to the address on error or rejection)
- ARCHIVE: archiveFileNameForm
- MYAUTH: username:password (AUTHINFO for NNTP server)
- OPTION: OptionList
isn -- Increment Sequence Number (to be referred by ${seqno})
rni -- Reject No message-Id
res -- Reject Empty Subject
reb -- Reject Empty Body
axo -- Append X-Original headers
rxo -- Remove X-Original headers
gwt -- GateWay Trace
ntr -- Do NOT add trace field (Received:)
- ACCEPT
-
If specified, only messages which have fields
matching with specified patterns are accepted.
- ACCEPT/Sender: ListOfEmailAddressPattern
- ACCEPT/Recipient: ListOfEmailAddressPattern
- ACCEPT/From: ListOfEmailAddressPattern
- ACCEPT/To: ListOfEmailAddressPattern
- ACCEPT/Max-Bytes: messageSize
- ACCEPT/Min-Body-Bytes: bodySize
- ACCEPT/Max-Exclams: theNumberOfExclamationMarks
- ACCEPT/User-Text: listOfWords (in Subject or body)
- REJECT/User-Text: listOfWords (in Subject or body)
- ACCEPT/Content-Type: listOfTypesOrCharsets
- ACCEPT/Client-Host: srcHostList
- OUTPUT
-
Header fields to be put into the output messages
replacing the original fields in the input message.
- Newsgroups: fieldBodyForm (to be used with "postnews")
- Distribution: fieldBodyForm (to be used with "postnews")
- Reply-To: fieldBodyForm
- To: fieldBodyForm
- Subject: fieldBodyForm
- Header: fieldName: fieldBodyForm
- FILTER: filterCommand
- Substitution
-
The following patterns appearing in ...Form in field body part
of directives are substituted with the values in the header
or the envelope of the input message.
- ${sender} -- sender in the envelope (in RCPT To)
- ${recipient} -- recipient in the envelope (in MAIL From)
- ${recipient.name} -- local name part of the recipient
- ${recipient.mx} -- Mail eXchanger of the recipient
- ${header.field} -- body of header field in the input message
- ${from} -- From field in the input message
- ${unixfrom} -- Unix-From string for the recipient
- ${subject} -- Subject field in the input message
- ${subject:hc} -- head-cleaned Subject field
- ${seqno} -- sequence number
- ${seqno/10} -- sequence number / 10 (used with ARCHIVE)
- ${seqno/100} -- sequence number / 100 (used with ARCHIVE)
- ${date+format} -- formatted string of current time (used with ARCHIVE)
When a SMTP-DeleGate received a message bound for a recipient,
with an address formed as recipient@mailhost,
it retrieves the configuration file for the recipient
in the following two directories in the order.
- SMTPGATE/users/recipient/
- SMTPGATE/admin/recipient/
If no configuration for the recipient is found,
then the default configuration is used if it exists at the following directory.
Otherwise the built-in default configuration is used.
The default is at "/-/builtin/config/smtpgate/@default/conf"
which can be customized with MOUNT option.
The contents of the default is like follows which means
just delivering the input message
to the address of the recipient via the mail exchanger of the recipient.
CONTROL/INHERIT: sendmail
CONTROL/RECIPIENT: ${recipient}
CONTROL/SERVER-HOST: ${recipient.mx}
The directory for each recipient contains following files.
- recipient/conf -- configuration file
- recipient/log -- log file
- recipient/count -- counter file for ${seqno} (optional)
- recipient/spool/ -- archive directory of relayed messages (optional)
- recipient/rejected/ -- archive directory of rejected ones (optional)
Optional ones will be enabled by manually creating the file or the directory.
Instead of the default archive file,
user can define the file name and the unit of archive by ARCHIVE directive.
Example:
- ARCHIVE: spool/%05${seqno}-${date+%Y%m%d-%H%M%S}-%05${pid}
- ## default archive enabled if spool/ exists
- ARCHIVE: arc-${seqno} ## archive with sequence number
- ARCHIVE: arc-%4${seqno/10} ## an archive file per every 10 messages
- ARCHIVE: arc-${date+%Y-%m} ## an archive file per month