SMTPD server/proxy for NaviServer
Release 2.1

    SMTPD proxy/server for Naviserver

This is Naviserver module that implements SMTP protocol 
and acts as SMTP proxy with anti-spam and anti-virus capabilities. 

To support anti-SPAM feature one of the following should be installed:

    * SpamAssasin <>
    * DSPAM <>: patched
      version <>. 

To support anti-virus feature one of the following should be installed:

    * ClamAV <>
    * Sophos: SAVI <> 


Add the following configuration directives to the nsd.tcl file, modules
section should already exist, so just add nssmtpd line there:

    ns_section      "ns/server/${server}/modules"
    ns_param        nssmtpd            ${home}/bin/
    ns_section      "ns/server/${server}/module/nssmtpd"
    ns_param        port                    2525
    ns_param        address       
    ns_param        relay                   localhost:25
    ns_param        spamd                   localhost
    ns_param        initproc                smtpd::init
    ns_param        rcptproc                smtpd::rcpt
    ns_param        dataproc                smtpd::data
    ns_param        errorproc               smtpd::error
    ns_param	    relaydomains	    "localhost"
    ns_param	    localdomains	    "localhost"

# For STARTTLS functionality
    ns_param certificate "pathToYourCertificateChainFile.pem"
    ns_param cafile ""
    ns_param capath ""

Once enabled, smtpd acts as SMTP server forwarding all messages to the
configured real smtp server via "relay" parameter. For each SMTP command
it calles configured Tcl handler which performs actual processing.


There is ns_smtpd command available in called Tcl handlers

ns_smtpd usage:

  nssmtpd flag
  nssmtpd send
  nssmtpd relay
  nssmtpd local
  nssmtpd encode
  nssmtpd decode
  nssmtpd checkemail - parses email and returns as name@domain if valid
  nssmtpd checkdomain
  nssmtpd virusversion - returns version of anti-virus tool used
  nssmtpd spamversion - returns version of anti-spam tool used
  nssmtpd checkspam
  nssmtpd trainspam
  nssmtpd checkvirus
  nssmtpd sessions
  nssmtpd gethdr
  nssmtpd gethdrs
  nssmtpd getbody
  nssmtpd getfrom
  nssmtpd getfromdata
  nssmtpd setfrom
  nssmtpd setfromdata
  nssmtpd getrcpt
  nssmtpd getrcptdata
  nssmtpd addrcpt
  nssmtpd setrcptdata
  nssmtpd delrcpt
  nssmtpd setflag
  nssmtpd unsetflag
  nssmtpd getflag
  nssmtpd setreply
  nssmtpd getline
  nssmtpd dump


nssmptd is covered by Mozilla license.


Vlad Seryakov
Gustaf Neumann