Both sides previous revisionPrevious revisionNext revision | Previous revision |
server:mail [2023/02/18 14:02] – New section on Recipients, for Keyop digital man | server:mail [2025/02/16 18:11] (current) – [sbbs.ini] Add NO_READ_POP3 option digital man |
---|
=== Special Aliases === | === 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. | 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 ==== |
| |
{{:server:SBBSCTRL.mailsrvr.advanced.png?400|}} | {{:server:SBBSCTRL.mailsrvr.advanced.png?400|}} |
==== External Mail Processors ==== | |
FIXME | |
| |
===== SendMail ===== | ===== SendMail ===== |
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 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): |
| RelayPassword | | Password used to authenticate with RelayServer | | | RelayPassword | | Password used to authenticate with RelayServer | |
| DNSServer | <auto> | IP address of DNS server used to discover mail-exchange servers for outbound mail destinations | | | DNSServer | <auto> | IP address of DNS server used to discover mail-exchange servers for outbound mail destinations | |
| | PostTo | | Override the recipient of all SMTP-posted messages (on sub-boards) with this value (e.g. "All") | |
| DefaultUser | | Default recipient of mail for unrecognized recipient names (blank = none) | | | DefaultUser | | Default recipient of mail for unrecognized recipient names (blank = none) | |
| DefaultCharset | | Default MIME Content-Type ''charset'' value when unspecified (e.g. ''IBM437'') | | | DefaultCharset | | Default MIME Content-Type ''charset'' value when unspecified (e.g. ''IBM437'') | |
| 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): |
| DEBUG_POP3 | Log all POP3 activity (Debug log level) | | | DEBUG_POP3 | Log all POP3 activity (Debug log level) | |
| TLS_POP3 | Support incoming POP3S (POP3/TLS) connections | | | TLS_POP3 | Support incoming POP3S (POP3/TLS) connections | |
| | NO_READ_POP3 | Do not mark POP3-retrieved mail messages as "Read" | |
| DEBUG_TX | Log all transmissions (Debug log level) | | | DEBUG_TX | Log all transmissions (Debug log level) | |
| DEBUG_RX_HEADER | Log headers of all received messages (Debug log level)| | | DEBUG_RX_HEADER | Log headers of all received messages (Debug log level)| |
| DEBUG_RX_BODY | Log body text of all received messages (Debug log level)| | | DEBUG_RX_BODY | Log body text of all received messages (Debug log level)| |
| DEBUG_RX_RSP | Log all received responses (Debug log level) | | | DEBUG_RX_RSP | Log all received responses (Debug log level) | |
| ALLOW_RX_BY_NUMBER | Allow email to be received by user number in addition to name/alias (not recommended) | | |
| ALLOW_SYSOP_ALIASES | Allow email to received for various administrative aliases (e.g. "sysop", "postmaster") to be delivered to the sysop | | | ALLOW_SYSOP_ALIASES | Allow email to received for various administrative aliases (e.g. "sysop", "postmaster") to be delivered to the sysop | |
| NO_NOTIFY | Do not send telegrams to users notifying them of newly received email | | | NO_NOTIFY | Do not send telegrams to users notifying them of newly received email | |
| |
| |
| ===== 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** | ''SBBS_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** file that 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 ===== |