wodSmtpServer ActiveX Control - MailTo Event
    
 

Description

Fires when user specifies receiver of the message


Syntax

Private Sub object_MailTo(User, Address, Action)



The MailTo Event syntax has these parts:

Part Description
object A wodSmtpServer object.
User A SmtpUser object. Reference to the user who sent 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, depnding if you will accept the recipient 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 'RCPT TO' command following his email or account name information. This isn't necessarily the same email address or name as provided by 'To:' 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 email address specified isn't really on your server, you can reject this message by setting Action property to Deny value. In this case, client will receive an error.

This is very typical scenario. When client refers to address of user that doesn't live on your server, you should deny posting of this email because your server shouldn't be general-purpose-relaying-server, but only server that accepts email for your account holders.

Before the message is actually posted, client can send RCPT TO command more than once. In this case, after message is posted you should copy it to all mailboxes client specified, so that everyone has a copy of the posted email. Once more, this isn't same as 'To:' header. This way, clients can send 'blind carbon copies' of email to different users, and having 'To' header set to something like 'Hidden recipients' or something similar.

Later, you can access last entered address using MailTo property.