Imap Object : Command Method |
This method allows standard and non-standard commands to be sent. The reply from the server is copied to Reply; you determine success or failure. Reply must not go out of scope while the command completes (it must have file or global scope)
The control appends a CR/LF pair to the end of all commands so you should not send commands with a trailing CR/LF.
All commands must begin with a unique command identifier. The control generates and adds this to the beginning of a command you should not send commands with preceding command identifiers.
This method may generate the following error code (refer to MailErrorConstants for a complete list of error codes):
Private Sub Command1_Click() On Error GoTo OnError ' use intrinsic error handling Dim Reply As String ' Timeout 30 seconds Imap1.Timeout = 30000 ' login to the server Imap1.Login "imap.test.com", "MyUsername", "MyPassword" ' send a standard NOOP command to the server Imap1.Command "NOOP", Reply MsgBox "Server Reply: " & Reply Exit Sub OnError: ' Any error jumps here Debug.Print "Error #" + CStr(Err.Number) + ": " + Err.Description End Sub