wodSmtpServer ActiveX Control - MailFrom Event
    
 

Description

Fires when user specifies sender of the message


Syntax

Private Sub object_MailFrom(User, Address, Action)



The MailFrom Event syntax has these parts:

Part Description
object A wodSmtpServer object.
User A SmtpUser object. Reference to the user who send this command.
Address A String value. Email address or account name user provided.
Action A SmtpActions enumeration, as described in settings. You should set it to Allow or Deny, depending if you will accept the sender 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

SMTP protocol specification says that before message is posted to the server, client should provide information about sender and recipient (among others) of the message, so that server can decide if it will accept the message or not. For this purpose, when client connects to server, he will issue MAIL FROM command following his email or account name information. This isn't necessarily the same email address or name as provided by From: header later in the message, so please don't try to look for it there later on.

When you receive this event, you should decide if your server will accept the message or not. For example, if you want to set up sort of Spam filter, you can just ignore emails received from certain email addresses, or even from certain computers on Internet. You can do this by evaluating contents of Address variable, and set Action = Allow to allow client to continue posting message, or Action = Deny to deny posting. Client will receive an error in that case.

Later, you can access address entered here using MailFrom property.