wodSmtpServer ActiveX Control - MailReceived Method
      
 

Description

Called when user finished sending mail body.


Return Type

None  


Syntax

object.MailReceived Owner, User, Action



The MailReceived Method syntax has these parts:

Part Description
object An expression evaluating to an object of type wodSmtpNotify.
Owner Required. A wodSmtpServer object. Reference to wodSmtpServerCom instance that called this callback method.
User Required. A SmtpUser object. Reference to the user who posted new message.
Action Required. 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

NOTE: This method is called only if you implemented IwodSmtpNotify interface in your application, and wodSmtpServer1.Notification property has received reference to instance of your implementation.

This notification method is called 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 notification is the best place to do so.  You can relay message as simple as this:

Private Sub INotifications_MailReceived(ByVal Owner As WODSMTPSERVERCOMLib.IwodSmtpServerCom, ByVal User As WODSMTPSERVERCOMLib.ISmtpUser, Action As WODSMTPSERVERCOMLib.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.