SendCommand Method


Executes user-supplied command on the IMAP4 server.

This method sends the following request to the IMAP4 server:

Autogenerated command tag + User-supplied command + CRLF

E.g. if user-supplied command is LIST "" "", request generated by MailBee looks like:

MBC000002 LIST "" ""CRLF

CRLF is a line delimiter (vbCrLf constant).

To see exact look of the generated request, enable logging on and check the log file.


strServerResponse = ObjectName.SendCommand(Command)  
Parameters:  
Command As String Command text  
Return value As String Response generated by the server in return to user-supplied command  

Usage example:

' This sample selects "Inbox" mailbox and displays total number of messages there

Dim Mailer
'Using visual basic to create object
Set Mailer = CreateObject("MailBee.IMAP4")
'Using ASP to create object
'Set Mailer = Server.CreateObject("MailBee.IMAP4")
'In ASP use Response.Write instead of MsgBox

Mailer.EnableLogging = True ' Logging helps to discover any problems
Mailer.LogFilePath = "C:\Temp\imap4_log.txt"

Mailer.LicenseKey = "put your license key here"
If Mailer.Connect("mailserver.com", 143, "MyName", "MyPassword") Then
  MsgBox Mailer.SendCommand("LIST """" """"")
  Mailer.Disconnect
Else
  MsgBox Mailer.ErrDesc
End If

See Also:

EnableLogging Property
LogFilePath Property


Copyright © 2002-2024, AfterLogic Corporation. All rights reserved.