(Tcl) Transition from Imap.FetchSingleHeader to Imap.FetchEmail
Provides instructions for replacing deprecated FetchSingleHeader method calls with FetchEmail. Note: This example requires Chilkat v11.0.0 or greater.
load ./chilkat.dll
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
|