hMailServer enable you to write your own scripts to extend the server's functionality. Support for Microsoft VBScript and Microsoft JScript currently exists in the server. You will find at hMailServer.com useful sample scripts written in VBScript. For general script syntax, you should consult the Microsoft MSDN library.
All hMailServer scripts should be placed in a file called EventHandlers.vbs. The file is found in the hMailServer Events directory, normally C:\Program Files\hMailServer\Events.
hMailServer offers the following pre-defined events:
Event | Purpose | Implemented in |
OnBackupCompleted | Executed when a backup has completed. | 4.2 |
OnBackupFailed | Executed when a backup has failed. | 4.2 |
OnClientConnect | Executed when a client is connected. | 4.0 |
OnAcceptMessage | Executed when an e-mail has been delivered to the server using the SMTP protocol. | 4.0 |
OnDeliveryStart | Executed directly when the delivery of an email has started, before any rules are executed. | 4.4 |
OnDeliverMessage | Executed when an e-mail is beeing delivered. Executed after global rules are executed, but before account-level rules. | 4.0 |
OnDeliveryFailed | Executed if delivery of a a message has failed | 5.0 |
OnExternalAccountDownload | Executed when a message has been downloaded from a remote POP3 account. | 5.3 |
Executed if a error occurs in hMailServer. | 5.0 | |
OnSMTPData | Executed when SMTP Data is received | 5.4 |
OnClientConnect (oClient)
spam tests >> DNSBlackilists, HELOhost, MXRecords, SPF
OnSMTPData (oClient, oMessage)
spam tests >> SURBL, DKIM, Greylisting, integrated SpamAssasin
OnAcceptMessage (oClient, oMessage)
OnDeliveryStart (oMessage)
integrated anti-virus check, Global rules
OnDeliverMessage (oMessage)
OnDeliveryFailed (oMessage, sRecipient, sErrorMessage) - if applicable
Message delivered to recipeint(s), Account level rules
Follow these steps to enable scripting:
See COM API for object references
For Developers the prototypes are in file: ScriptServer.h
https://github.com/hmailserver/hmailser ... ptServer.h