The CoffeeMud SMTP Server:
The CoffeeMud SMTP Server is a simple mail transfer program which acts as server that runs as part of CoffeeMud. It's primary purpose is to act as a mail forwarding and relay engine for email between mud users, and as a distribution point for mailing lists and other email related functions.

How to Connect:
By default, the smtp server listens on port port 25 by default. Changing this port value is generally a bad idea which will almost certainly eliminate the ability for your server to receive mail from others.

Messages sent either directly or indirectly to the CoffeeMud SMTP Server MUST follow ALL of these rules or face rejection:

- The email MUST be formatted in PLAIN TEXT
- The DOMAIN must be correctly defined in the SMTP Server INI file (email.ini)
- The email must be from:
  - a coffeemud journal name listed under JOURNALS in the SMTP Server INI file (email.ini)
  - OR a coffeemud journal name at the local domain: example: My_Journal@coffeemud.homeip.net
  - OR a local player name
  - OR a local player name at the local domain: example: brutus@coffeemud.homeip.net
  - OR the email address which a player has on file in their account.
- The email must be addressed to:
  - a coffeemud journal name at the local domain: example: My_Journal@coffeemud.homeip.net
  - OR a local player name at the local domain: example: brutus@coffeemud.homeip.net
  - OR the email address which a player has on file in their account.

What it does and doesn't do:
It accepts mail for storage and eventual delivery if the security conditions are met. It maintains mailing lists for journals. It provides security against illegal postings to journals or mailing lists. It delivers emails to where they need to go, and distributes mailing list messages to where they need to go.

It does not handle SMTP compliant mailing lists, and will only deal with plain text messages due to journal interactions.
It supports HELO, EHLO, RCPT, MAIL, HELP, QUIT, NOOP, RSET, DATA, and DSN.

It does not support EXPN, VRFY, VERB, ETRN, or any expanded parameters to either MAIL or RCPT.

Security:
The SMTP Server may be bound to 127.0.0.1 (localhost) - this means it will not accept external connections.

The SMTP Server only allows messages FROM valid users or journals TO valid users or journals. All security checking is done as the message is arriving, so there is no chance of an invalid message taking up disk space, much less being relayed. It doesn't get any more secure than that.

Configuration:
The default installation of CoffeeMud has two inbuilt web servers, named 'pub' and 'admin'. The web servers are enabled with the line 'RUNWEBSERVERS=true' in 'coffeemud.ini'; any other value or the abscence of this line will cause the web servers not to be loaded.

INI files for the web servers live in the 'web/' directory off the CoffeeMud root; by default, all pages to be served go in web/(servername)/, though this can be overridden. Options are placed in either 'web/common.ini' or 'web/(servername).ini'; an option in the latter will override one in common. The options are:

- PORT=xx : [REQUIRED] (e.g.25) Sets the port number the server will listen for SMTP requests on; this cannot be the same port as the main MUD server or web servers. Identical to MUD server usage. There is normally no good reason to change from 25, as that is what email clients will expect.
- BACKLOG=xx : (e.g.10) Sets the number of requests that can be queued by the internal TCP/IP stack. Identical to MUD server usage.
- BIND=addr : (e.g.127.0.0.1) Causes the server to be bound to a specific address; this is useful on multi-homed machines or if you wish to prevent public access to the pages. Identical to MUD server usage.
- FORWARD=trueorfalse (e.g. TRUE) Should be set to true or false. If TRUE, mail will be forwarded to players and mailing lists as the mail becomes available. A player will have their mail forwarded to them ONLY if their AUTOFORWARD flag is set. If this option is FALSE, the server will not forward mail no matter what the players AUTOFORWARD flag is, but will act as a mail accumulator only.
- MAILBOX=journalname (e.g. The EMail Box) This is the name of your private email Journal. All private email, from player to player, is stored in this journal. A GenJournal item of this name can be created in-game to provide in-game access to email for players who do not have AUTOFORWARD turned on. Otherwise, when FORWARD is true, and the player has AUTOFORWARD turned on, email will remain in this box only until it can be successfully sent to the players private email address.
- EMAILDAYS=xx (e.g. 30) This is the maximum number of days a message will remain in the MAILBOX above for any reason.
- FAILUREDAYS=xx (e.g. 5) This is the number of days that your server will attempt to forward a message to a private email address before giving up.
- MAXMSGS=xx (e.g. 100) This is the maximum number of private emails which will be stored in the MAILBOX for each player. Use 0 for unlimited.
- MAXMSGSIZE=xx (e.g. 20000) This is the maximum number of bytes for each email sent. No email arriving through your server may exceed this size.
- JOURNALS=coded list
  e.g. Local Chat, The Elf Journal (forward keepall -RACE +Elf), Announcements (forward)
  This is the name of one of more GenJournal (see Archon Guide). Each entry should be comma delimited. The mails sent to a journal name will appear as TO ALL messages in the designated journal. The names listed here are case sensitive with respect to your GenJournal names. Mail may be sent to journal names with spaces by substituting an unscore "_" for each space. For instance, to send an email to a journal called "The Journal" at the domain "mydomain.com", you would address it as: The_Journal@mydomain.com .
  For each journal entry, parameters may follow the name, so long as they are enclosed in parenthesis. ().
  The parameters may include the word 'forward' if you would like emails to be forwarded to the private mail boxes whose names are maintained in resources/emaillists.txt. Nonmembers may post a message to the journal # or send an email with "subscribe" as the subject to subscribe. Members may likewise use "unsubscribe" to remove their names.
  The Parameters should include the word 'subscribeonly' if posts to the list are not accepted, but subscribe/unsubscribe messages are. This parameter should always be used with the 'forward' parameter.
  The Parameters should include the word 'keepall' if posts to the journal are saved in the journal archives instead of automatically deleted after forwarding. Like 'subscribeonly', this parameter ONLY matters when 'forward' is included. Posts to journals are never deleted unless 'forward' is set. See the JOURNALDAYS ini entry below for ways to delete these messages even when 'keepall' is included.
  Parameters may also include Zapper masks to control subscription and/or posting criteria. Use AHELP Prop_HaveZapper to list the valid Zapper mask parameters.
- JOURNALDAYS= xx (e.g. 90) This is the number of maximum number of days a message will remain in an smtp server managed JOURNAL before being deleted.
- SUBSCRIBEDTITLE=xx (e.g. You are now subscribed) This is the title of the response your SMTP server will automatically send to users who subscribe to a journal by sending an email to the journal with "subscribe" as the title.
- SUBSCRIBEDMSG=xx (e.g. You are now subscribed to <NAME>) This is the body of the response your SMTP server will automatically send to users who subscribe to a journal by sending an email to the journal with "subscribe" as the title. You may use the code <NAME> as a placeholder for your journals name.
- UNSUBSCRIBEDTITLE=xx (e.g. You are now unsubscribed) This is the title of the response your SMTP server will automatically send to users who unsubscribe to a journal by sending an email to the journal with "unsubscribe" as the title.
- UNSUBSCRIBEDMSG=xx (e.g. You are now unsubscribed from <NAME>) This is the body of the response your SMTP server will automatically send to users who unsubscribe to a journal by sending an email to the journal with "unsubscribe" as the title. You may use the code <NAME> as a placeholder for your journals name.

Not listed here, but even more important is the DOMAIN entry in your coffeemud.ini file. This is your servers domain for the purposes of interpreting local email addresses. It should be identical to your servers domain. For instance, if your server is myserver.myhost.com, then so should this value. Email addressed to your mud would then be playername@myserver.myhost.com. This domain must match the incoming mail addresses to be accepted.