Synchronet v3.19b-Win32 (install) has been released (Jan-2022).

You can donate to the Synchronet project using PayPal.

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revisionPrevious revision
Next revision
Previous revision
server:mail [2020/07/07 21:27] grasshopperserver:mail [2024/03/04 18:30] (current) – [Configure] Updated SCFG screenshot digital man
Line 16: Line 16:
  
 The SMTP server also supports the SEND, SAML and SOML commands for delivering instant messages (a.k.a. telegrams) to users of the BBS. The SMTP server also supports the SEND, SAML and SOML commands for delivering instant messages (a.k.a. telegrams) to users of the BBS.
 +
 +==== Recipients ====
 +When receiving email messages via SMTP, the Synchronet mail server can match recipient names to a BBS user account by their alias or optionally, their real name. 
 +
 +=== Special Characters ===
 +Non-alphanumeric characters are ignored when matching recipient names to BBS user aliases. So for example, the following will all match the user "digital man":
 +  * ''digital.man''
 +  * ''digital_man''
 +  * ''digitalman''
 +  * ''d-i-g-i-t-a-l-man''
 +
 +=== Real Names ===
 +When matching recipient names to BBS real names (if so enabled by the sysop by setting SCFG->Message Options->Receive E-mail by Real Name to "Yes"), spaces and '.' are treated as equivalent. When "Receive E-mail by Real Name" is enabled, receiving e-mail by user's alias is still supported.
 +
 +=== Special Aliases ===
 +Recipient names configured in ''[[dir:ctrl]]/[[config:alias.cfg]]'' can be used to match recipient names to specific user account numbers, aliases, external email addresses, or even sub-boards.
 +
 +=== User Number ===
 +Receiving by user account number is also optionally supported, not not encouraged and disabled by default.
  
 ==== Special Prefixes ==== ==== Special Prefixes ====
Line 47: Line 66:
 The Synchronet Mail Server recognizes the incoming special address format: ''//<name>//#//<tag>//@//<host>//'' The Synchronet Mail Server recognizes the incoming special address format: ''//<name>//#//<tag>//@//<host>//''
  
-The //<tag>// is extracted from the address and if it is **not** found in the ''data/user/<usernum>.smtptags'' file, the mail message is +The //<tag>// is extracted from the address and if it is **not** found in the ''data/user/<usernum>.smtpblock'' file, the mail message is 
-sent to the destination user.  If the tag matches a line in the ''.smtptags'' file, the email is rejected by the mail server with a "no such user" error.+sent to the destination user.  If the tag matches a line in the ''.smtpblock'' file, the email is rejected by the mail server with a "no such user" error.
  
-This feature allows you (the sysop) to easily create and use "temporary" email addresses without requiring additional user accounts.  Once you start receiving spam with a tag, just disable that tag by adding it to your ''.smtptags'' file.+This feature allows you (the sysop) to easily create and use "temporary" email addresses without requiring additional user accounts.  Once you start receiving spam with a tag, just disable that tag by adding it to your ''.smtpblock'' file.
  
 ==== Anti-SPAM ==== ==== Anti-SPAM ====
Line 95: Line 114:
  
 {{:server:SBBSCTRL.mailsrvr.advanced.png?400|}} {{:server:SBBSCTRL.mailsrvr.advanced.png?400|}}
-==== External Mail Processors ==== +
-FIXME+
  
 ===== SendMail ===== ===== SendMail =====
Line 130: Line 148:
 false positives). false positives).
  
-===== sbbs.ini =====+===== Configure ===== 
 + 
 +The Synchronet Mail Server can be configured via [[util:SCFG]]:Servers->Mail Server: 
 + 
 +<file> 
 +╔════════════════════════════════════════════╗ 
 +║                 Mail Server                ║ 
 +╠════════════════════════════════════════════╣ 
 +║ │Enabled                       Yes         ║ 
 +║ │Log Level                     Info        ║ 
 +║ │SMTP Interfaces               0.0.0.0, :: ║ 
 +║ │SMTP Support                  Port 25     ║ 
 +║ │Submission Support            Port 587    ║ 
 +║ │Submission/TLS Support        Port 465    ║ 
 +║ │POP3 Interfaces               0.0.0.0, :: ║ 
 +║ │POP3 Support                  Port 110    ║ 
 +║ │POP3/TLS Support              Port 995    ║ 
 +║ │Max Clients                   100         ║ 
 +║ │Max Inactivity                2 minutes   ║ 
 +║ │Max Concurrent Connections    Unlimited   ║ 
 +║ │Max Recipients Per Message    100         ║ 
 +║ │Max Messages Waiting          100         ║ 
 +║ │Max Receive Message Size      20M bytes   ║ 
 +║ │Default Recipient                         ║ 
 +║ │Receive By User Number        No          ║ 
 +║ │Receive By Sysop Aliases      No          ║ 
 +║ │Notify Local Recipients       Yes         ║ 
 +║ │Notify Offline Recipients     Yes         ║ 
 +║ │Allow Users to Relay Mail     No          ║ 
 +║ │Lookup Client Hostname        Yes         ║ 
 +║ │Check Headers against DNSBL   No          ║ 
 +║ │DNS-Blacklisted Servers       Tag Mail    ║ 
 +║ │Hash DNS-Blacklisted Msgs     No          ║ 
 +║ │Kill SPAM When Read           No          ║ 
 +║ │SendMail Support...                       ║ 
 +║ │Login Requirements                        ║ 
 +║ │JavaScript Settings...                    ║ 
 +║ │Failed Login Attempts...                  ║ 
 +╚════════════════════════════════════════════╝ 
 +</file> 
 + 
 +... via [[monitor:SBBSCTRL]]:Mail->Configure: 
 + 
 +{{:server:sbbsctrl.3.20.mail.config.png|}} 
 + 
 +... or by editing the ''[Mail]'' section fo the ''[[dir:ctrl]]/[[config:sbbs.ini]]'' file. 
 + 
 +==== sbbs.ini ====
  
 The ''[mail]'' section of the ''[[dir:ctrl]]/[[config:sbbs.ini]]'' file supports the following configuration settings (''key = value'' lines): The ''[mail]'' section of the ''[[dir:ctrl]]/[[config:sbbs.ini]]'' file supports the following configuration settings (''key = value'' lines):
  
 ^ Key               ^ Default Value ^ Description ^ ^ Key               ^ Default Value ^ Description ^
-| Interface         | [global] Interface | Comma-separated list of IPv4 and IPv6 network interfaces to listen on for incoming SMTP/SMTPS connections | +| AutoStart         | true          | Automatically start up the server (manual is only supported in [[monitor:sbbsctrl]]) | 
-| POP3Interface     [global] Interface | Comma-separated list of IPv4 and IPv6 network interfaces to listen on for incoming POP3/POP3S connections | +| Interface         | [global]      | Comma-separated list of IPv4 and IPv6 network interfaces to listen on for incoming SMTP/SMTPS connections | 
-| OutboundInterface | 0.0.0.0       | IPv4 network interface to use for outgoing SMTP/SMTPS connections (0.0.0.0 = //any interface//) |+| POP3Interface     | Interface     | Comma-separated list of IPv4 and IPv6 network interfaces to listen on for incoming POP3/POP3S connections | 
 +| OutboundInterface | [global]      | IPv4 network interface to use for outgoing SMTP/SMTPS connections (0.0.0.0 = //any interface//) |
 | SMTPPort          | 25            | TCP port number to listen on for incoming SMTP mail-delivery connections | | SMTPPort          | 25            | TCP port number to listen on for incoming SMTP mail-delivery connections |
 | SubmissionPort    | 587           | TCP port number to listen on for incoming SMTP mail-submission connections | | SubmissionPort    | 587           | TCP port number to listen on for incoming SMTP mail-submission connections |
Line 144: Line 210:
 | TLSPOP3Port       | 995           | TCP port number to listen on for incoming POP3S (encrypted) mail-retrieval connections | | TLSPOP3Port       | 995           | TCP port number to listen on for incoming POP3S (encrypted) mail-retrieval connections |
 | MaxClients        | 10            | Maximum number of simultaneous incoming TCP sessions supported | | MaxClients        | 10            | Maximum number of simultaneous incoming TCP sessions supported |
 +| MaxConcurrentConnections | 0      | Maximum number of concurrent connections (without login) from the same IP address (0 = unlimited) |
 | MaxInactivity     | 120           | Maximum amount of TCP session inactivity before timeout and disconnection (in seconds) | | MaxInactivity     | 120           | Maximum amount of TCP session inactivity before timeout and disconnection (in seconds) |
 | MaxDeliveryAttempts | 50          | Maximum number of outbound mail delivery attempts before mail is bounced back to sender | | MaxDeliveryAttempts | 50          | Maximum number of outbound mail delivery attempts before mail is bounced back to sender |
Line 153: Line 220:
 | MaxMsgsWaiting        | 100       | Maximum number of messages allowed in a (non-W-exempt) user's inbox | | MaxMsgsWaiting        | 100       | Maximum number of messages allowed in a (non-W-exempt) user's inbox |
 | ConnectTimeout        | 30        | Timeout (in seconds) before blocked outbound SMTP/TCP connections are aborted | | ConnectTimeout        | 30        | Timeout (in seconds) before blocked outbound SMTP/TCP connections are aborted |
-| HostName              | [global] HostName  | Hostname of this server | +| HostName              | [global]  | Hostname of this server | 
-| TempDirectory         | [global] TempDirectory | Directory to use for the storage of temporary files |+| TempDirectory         | [global]  | Directory to use for the storage of temporary files |
 | RelayServer                     | Hostname or IP address of SMTP server to relay outbound mail through (requires ''RELAY_TX'' option) | | RelayServer                     | Hostname or IP address of SMTP server to relay outbound mail through (requires ''RELAY_TX'' option) |
 | RelayPort             | 25        | TCP port number to connect with when relaying mail to RelayServer | | RelayPort             | 25        | TCP port number to connect with when relaying mail to RelayServer |
Line 167: Line 234:
 | InboundSound          |           | WAV file to play upon incoming SMTP/SMTPS connections (Windows only) | | InboundSound          |           | WAV file to play upon incoming SMTP/SMTPS connections (Windows only) |
 | OutboundSound                   | WAV file to play upon outgoing SMTP/SMTPS connections (Windows only) | | OutboundSound                   | WAV file to play upon outgoing SMTP/SMTPS connections (Windows only) |
-| NewMailNotice         | "New e-mail from <%s>\r\n" | Format of telegram to send users upon receipt of incoming mail message | +| JavaScript*           | [global]  | JavaScript-related settings for external mail processing | 
-| ForwardNotice         | "and it was forwarded to: %s | Additional telegram text to send to recipient of automatically forwarded mail | +| LogLevel              | [global]  | Minimum severity of log messages to be displayed / stored | 
-| JavaScript*           | [global] JavaScript*    | JavaScript-related settings for external mail processing | +| BindRetryCount        | [global]  | Maximum number of TCP port bind attempts before failure | 
-| LogLevel              | [global] LogLevel*      | Minimum severity of log messages to be displayed / stored | +| BindRetryDelay        | [global]  | Delay (in seconds) between TCP port bind retries | 
-| BindRetryCount        | [global] BindRetryCount | Maximum number of TCP port bind attempts before failure | +| LoginAttempt*         | [global]  | Failed login attempt throttling / filtering / banning |
-| BindRetryDelay        | [global] BindRetryDelay | Delay (in seconds) between TCP port bind retries | +
-| LoginAttempt*         | [global] LoginAttempt*  | Failed login attempt throttling / filtering / banning |+
 | Options               | ''ALLOW_POP3'' | Mail server option flags (see below for details) | | Options               | ''ALLOW_POP3'' | Mail server option flags (see below for details) |
  
-==== Options ====+=== Options ===
  
 The ''Options'' key of the ''[mail]'' section of the ''[[dir:ctrl]]/[[config:sbbs.ini]]'' file supports the following option flags (separated by a ''|'' character): The ''Options'' key of the ''[mail]'' section of the ''[[dir:ctrl]]/[[config:sbbs.ini]]'' file supports the following option flags (separated by a ''|'' character):
Line 212: Line 277:
 | NO_RECYCLE          | Do not allow this server to be automatically recycled by external event | | NO_RECYCLE          | Do not allow this server to be automatically recycled by external event |
 | KILL_READ_SPAM      | Mark received SPAM messages for "Kill after read" | | KILL_READ_SPAM      | Mark received SPAM messages for "Kill after read" |
-| MUTE                | Disable all sound (WAV) files from playing | 
  
  
 +===== External Mail Processors =====
 +
 +In-bound e-mail (received via SMTP) can be intercepted and modified via one or more external mail processors.
 +
 +An external mail processor needs to create, remove or modify one or more files to have its impact
 +on the SMTP mail receive process. These files (created in the mail server's temporary file directory) are:
 +
 +^ Name                   ^ Example Filename    ^ Format   ^ Description ^
 +| **message_text**       | ''SBBS_SMTP.*.msg'' | [[https://www.rfc-editor.org/rfc/rfc5322|RFC-822]]   | Complete message header and body as received via SMTP |
 +| **new_message_text**   | ''SBBS_SMTP.*.new'' | [[https://www.rfc-editor.org/rfc/rfc5322|RFC-822]]   | New (replacement) message header and body (optional) |
 +| **recipient_list**     | ''SBSB_SMTP.*.lst'' | ''[[config:ini_files|.ini]]'' |List of all SMTP recipients for this message (see below for details) |
 +| **processing_error**   | ''SBBS_SMTP.*.err'' | US-ASCII | File that if created will reject this message with an SMTP error  |
 +| **log_text**           | ''SBBS_SMTP.*.log'' | US-ASCII | If created will include debug output from the external mail processor to be logged |
 +
 +Since the file **names** contain SMTP-session specific information (e.g. numbers), the filenames must be passed from the Mail Server to external mail processors via command-line or JavaScript properties.
 +
 +=== Message Text ===
 +
 +An external mail processor may either modify the **message_text** file in-place or create a **new_message_text** will be used in its place.
 +
 +=== Recipient List ===
 +
 +SMTP envelop information is stored in the **recipient_list** file. 
 +
 +The recipient list file has a ''.ini'' [section] for each recipient. Though the section name is an increasing decimal integer value (0, 1, etc.), there's no strict requirement that the recipient sections are so named, as long as they are uniquely named.
 +
 +An external mail processor may add, remove, or modify recipients in the recipient list file.
 +
 +An example recipient list file for 4 recipients (3 remote/forward, 1 local):
 +
 +<file ini>
 +[0]
 +To=jack.ryan@vert.synchro.net
 +ToExt=636
 +ToNetType=5
 +ToNetAddr=ryan.jack@gmail.com
 +[1]
 +To=steven.tyler@vert.synchro.net
 +ToExt=1080
 +ToNetType=5
 +ToNetAddr=someone@gmail.com
 +[2]
 +To=ricky.bobby@vert.synchro.net
 +ToExt=190
 +[3]
 +To=austin.powers@vert.synchro.net
 +ToExt=418
 +ToNetType=5
 +ToNetAddr=another@yahoo.com
 +</file>
 +
 +  * The ''To'' value contains the recipients "name"
 +  * The ''ToNetAddr'' value contains the recipients full email address
 +  * The ''ToNetType'' value corresponds with SMB network types (0=None, 2=Fido, 4=QWKnet, 5=Internet)
 +  * The ''ToExt'' value contains the recipient's user number on the BBS, when relevant
 +
 +==== Configure ====
 +
 +The mail processors are configured in the ''[[dir:ctrl]]/[[config:mailproc.ini]]'' file.
 +
 +Each mail processor is specified in a separate "section", comprised of the
 +mail processor name (or command-line) enclosed in square brackets ("[]"), 
 +followed by a list of optional "key = value" pairs.
 +
 +Supported ''[[dir:ctrl]]/[[config:mailproc.ini]]'' keys (for each mail processor) with default values:
 +
 +^ Key                    ^ Default      ^ Description ^
 +| ''Disabled''           | ''false''    | Set to true to disable |
 +| ''PassThru''           | ''true''     | A mail message should "pass-through" to a BBS user's inbox |
 +| ''Native''             | ''false''    | The mail process is a native (not JavaScript) program |
 +| ''IgnoreOnError''      | ''false''    | If there's an error reported, ignore it |
 +| ''To''                 | //none//     | Comma-separate list of possible recipient matches (name or name@address, filter wildcards and ''!'' logic negation supported) |
 +| ''From''               | //none//     | Comma-separate list of required sender names (filter wildcards and ''!'' logic negation supported) |
 +| ''AccessRequirements'' | //none//     | Optional access requirements for the processor to run |
 +| ''ProcessSPAM'''       | ''true''     | Set to ''false'' to not process SPAM-tagged messages |
 +| ''ProcessDNSBL''       | ''true''     | Set to ''false'' to not process mail from DNS-blacklisted clients |
 +| ''Command''            | //section//  | The command or script name to invoke |
 +| ''Eval''               | //none//     | The JavaScript expression to invoke |
 +
 +If no ''Eval'' or ''Command'' key value is specified, the mail processor name
 +will be used as the command-line to execute.
 +
 +Non-JavaScript mail processors (i.e. native executables), must have the 
 +''native'' key set to ''true''.
 +
 +For a mail processor to only process mail received for specific name(s),
 +it must have a ''To'' key with a comma-separated list of destination names.
 +
 +Example: ''To = listserver, listserv'' would cause a mail processor to only
 +process mail received for either ''listserver'' or ''listserv''.
 +
 +If no ''To'' value is specified, then the mail processor will process **all**
 +incoming (SMTP) e-mail messages.
 +
 +The ''From'' key is similar to the ''To'' key:
 +a list of zero or more strings to be used to determine which 
 +sender addresses the mail processor should be executed for.
 +
 +The strings in the to/from lists may use the Synchronet ''.can'' style comparison patterns.
 +
 +== Pass-through ==
 +
 +If a ''To'' value is specified, but is not a valid user name, then the 
 +''PassThru'' key must be set to ''false'' or the mail may be rejected or
 +forwarded (depending on the system configuration).
 +
 +=== JavaScript Variables ===
 +
 +The filenames referenced below may all be modified or created by the mail processor.
 +
 +Additional (read-only) variables available to JavaScript mail processors:
 +
 +^ Variable                      ^ Description ^
 +| ''message_text_filename'' | filename contains complete message header and body |
 +| ''new_message_text_filename'' | completely new message header and body (optional) |
 +| ''recipient_list_filename'' | list of all SMTP recipients for this message (.ini format) |
 +| ''processing_error_filename'' | a filename that if created will reject this message with an SMTP error |
 +| ''log_text_filename''         | an optional filename that if created will include debug log output |
 +| ''hello_name'' | the "HELO" name specified by the sender during the SMTP session |
 +| ''sender_name'' | the name of the sender, possibly the same as the sender_address |
 +| ''sender_address'' | sender's email address (e.g. "user@domain.com") |
 +| ''reverse_path'' | sender's SMTP reverse-path from SMTP envelope (e.g. "<user@domain.com>") |
 +| ''recipient_address'' | last specified recipient in SMTP session (e.g. "you@your.host.com") |
 +
 +* See ''[[dir:exec]]/mailproc_util.js'' and ''[[dir:exec]]/listserver.js'' for example uses.
 +
 +JavaScript mail processors may be implemented as either a single "Eval"
 +string or an external JavaScript file (e.g. ''*.js'').
 +
 +External JavaScript mail processors (''.js'' files) are loaded from the ''[[dir:mods]]''
 +or ''[[dir:exec]]'' directory if no path is specified on the command-line. 
 +If no file extension is specified on the command-line, ''.js'' is assumed.
 +
 +=== Command-line Specifiers ===
 +
 +Command-line specifiers (variables) are available for use in external mail processor command-lines:
  
 +^ Specifier ^ Description ^
 +| ''%m''    | mail message (header and body text) path/filename |
 +| ''%n''    | new message (header and body text) path/filename, in case you can't modify the original |
 +| ''%l''    | recipient list path/filename |
 +| ''%e''    | processing error path/filename (put error text in this file) |
 +| ''%d''    | processing debug log output path/filename |
 +| ''%h''    | sender's host name |
 +| ''%i''    | sender's IP address |
 +| ''%s''    | sender's name |
 +| ''%a''    | sender's address |
 +| ''%u''    | sender's user number (0 if unauthenticated) |
 +| ''%r''    | reverse path (of SMTP "envelope") |
 +| ''%t''    | recipient's address (from SMTP "envelope") |
 +| ''%!''    | exec dir |
 +| ''%g''    | temp dir |
 +| ''%j''    | data dir |
 +| ''%k''    | ctrl dir |
 +| ''%z''    | text dir |
 +| ''%o''    | sysop name | 
 +| ''%q''    | system QWK-ID |
 +| ''%v''    | Synchronet version |
 +| ''%?''    | platform |
 +| ''%%''    | percent symbol |
  
 ===== See Also ===== ===== See Also =====