wodSmtpServer ActiveX Control - MailReceived Event
    
 

Description

Fires when user finished sending mail body.


Syntax

Private Sub object_MailReceived(User, Action)



The MailReceived Event syntax has these parts:

Part Description
object A wodSmtpServer object.
User A SmtpUser object. Reference to the user who posted new message.
Action A SmtpActions enumeration, as described in settings. You should set it to Allow or Deny, depending if you want to accept the message or not.

Settings

The settings for Action are:

Constant Value Description
 Deny 0 Deny execution of the action.
 Allow 1 Allow to execute action.
 SilentDeny 2 Silently deny execution of the action.
 SilentAllow 3 Silently allow to execute action.

Remarks

This event is fired just after client posted message body. At this point, you should decide what you will do with the message. If you don't like received message - be fair enough and inform client so, by setting Action = Deny.

If you will store message to appropriate mailbox, you can leave Action variable as is (default is set to Allow). However, you should really copy received message to destination mailbox or folder with messages.

NOTE: If you plan to relay received message, this event is the best place to do so.  You can relay message as simple as this:

Private Sub wodSmtpServer1_MailReceived(ByVal User As WODSMTPSERVERCtl.ISmtpUser, Action As WODSMTPSERVERCtl.SmtpActions)
      wodSmtpServer1.Relays.Add User.Message
End Sub

Once message is received, you can open it from saved file and parse (or do whatever needed) with any MIME parsing program/component, such as wodMailbox.