Sample code for 30+ languages & platforms
Tcl

Transition from Imap.FetchSingleHeader to Imap.FetchEmail

Provides instructions for replacing deprecated FetchSingleHeader method calls with FetchEmail.

Chilkat Tcl Downloads

Tcl

load ./chilkat.dll

set success 0

set imap [new_CkImap]

# ...
# ...

# ------------------------------------------------------------------------
# The FetchSingleHeader method is deprecated:

# emailObj is a CkEmail
set emailObj [CkImap_FetchSingleHeader $imap 1 0]
if {[CkImap_get_LastMethodSuccess $imap] == 0} then {
    puts [CkImap_lastErrorText $imap]
    delete_CkImap $imap
    exit
}

# ...
# ...

delete_CkEmail $emailObj

# ------------------------------------------------------------------------
# Do the equivalent using FetchEmail.
# Your application creates a new, empty Email object which is passed 
# in the last argument and filled upon success.

set headerOnly 1

set emailOut [new_CkEmail]

set success [CkImap_FetchEmail $imap $headerOnly 1 0 $emailOut]
if {$success == 0} then {
    puts [CkImap_lastErrorText $imap]
    delete_CkImap $imap
    delete_CkEmail $emailOut
    exit
}


delete_CkImap $imap
delete_CkEmail $emailOut