wodSmtpServer ActiveX Control - Command Event
    
 

Description

Fires when user issues new command.


Syntax

Private Sub object_Command(User, Command)



The Command Event syntax has these parts:

Part Description
object A wodSmtpServer object.
User A SmtpUser object. Reference to user who sent a command.
Command A String value. Represents command and parameters entered.

Remarks

This event will be fired each time user issues some command, no matter what user's state is set to. For instance, after Connecting event you will not receive any additional events until user sends HELO or EHLO command. However, if you're interested if he's testing your server for some other commands or vulnerabilities, you can just track down every command he sends using this property.

You should understand that this event is in the middle of the chain between user's command and Smtp server's processor. This means that before Smtp server receives this command and evaluate it, you will receive an event where you can change Command parameter. Changing this parameter will directly affect Smtp server's behavior. For instance, if user sends command 'HELO mail.sun.com' you can do

Command = "HELO mail.microsoft.com"

Do you have idea what will happen? Smtp server will receive HELO information as you changed it, so it will store this in email message. Later you can change any particular command this way.

If you don't like how Smtp server reacts on specific command, you can implement it yourself different way. For instance, if you want 'HELO' command not to work, you can just do something like this:

If Ucase$(Left$(Command, 4)) = "HELO" Then
  Command = ""
  User.Send "550 command unrecognized" & vbCrLf
End If

This way Smtp server will just ignore command because Command is set to empty string, and you already sent some reply, so no protocol violations are made.

More, if you want to implement new command, for instance 'HELP' command you should do same as above - test if command is entered, set Command parameter to empty string, and Send some response manually using Smtp protocol specification.