Tcl
Tcl
Send a Raw IMAP Command
See more IMAP Examples
Demonstrates the Chilkat Imap.SendRawCommand method, which sends raw IMAP command text and returns the raw server response. Pass the command itself (such as NOOP) without an IMAP tag — Chilkat adds the tag automatically. This example sends a raw NOOP.
Background: Every IMAP command a client sends is prefixed with a short unique tag (like
a001) so the client can match the tagged completion response to the command it issued. SendRawCommand handles that tagging for you and returns the server's reply verbatim — an escape hatch for issuing a command Chilkat doesn't wrap directly, or a server-specific extension, without leaving the established authenticated session.Chilkat Tcl Downloads
load ./chilkat.dll
set success 0
# Demonstrates the Imap.SendRawCommand method, which sends raw IMAP command text and returns
# the raw server response. Pass the command itself (such as NOOP) without an IMAP tag --
# Chilkat adds the tag automatically.
set imap [new_CkImap]
CkImap_put_Ssl $imap 1
CkImap_put_Port $imap 993
set success [CkImap_Connect $imap "imap.example.com"]
if {$success == 0} then {
puts [CkImap_lastErrorText $imap]
delete_CkImap $imap
exit
}
set success [CkImap_Login $imap "user@example.com" "myPassword"]
if {$success == 0} then {
puts [CkImap_lastErrorText $imap]
delete_CkImap $imap
exit
}
# Send a raw IMAP command and read the raw response.
set response [CkImap_sendRawCommand $imap "NOOP"]
if {[CkImap_get_LastMethodSuccess $imap] == 0} then {
puts [CkImap_lastErrorText $imap]
delete_CkImap $imap
exit
}
puts "$response"
set success [CkImap_Disconnect $imap]
if {$success == 0} then {
puts [CkImap_lastErrorText $imap]
delete_CkImap $imap
exit
}
delete_CkImap $imap