PureBasic
PureBasic
Transition from Imap.FetchSingle to Imap.FetchEmail
Provides instructions for replacing deprecated FetchSingle method calls with FetchEmail.Chilkat PureBasic Downloads
IncludeFile "CkEmail.pb"
IncludeFile "CkImap.pb"
Procedure ChilkatExample()
success.i = 0
imap.i = CkImap::ckCreate()
If imap.i = 0
Debug "Failed to create object."
ProcedureReturn
EndIf
; ...
; ...
; ------------------------------------------------------------------------
; The FetchSingle method is deprecated:
emailObj.i = CkImap::ckFetchSingle(imap,1,0)
If CkImap::ckLastMethodSuccess(imap) = 0
Debug CkImap::ckLastErrorText(imap)
CkImap::ckDispose(imap)
ProcedureReturn
EndIf
; ...
; ...
CkEmail::ckDispose(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.
headerOnly.i = 0
email.i = CkEmail::ckCreate()
If email.i = 0
Debug "Failed to create object."
ProcedureReturn
EndIf
success = CkImap::ckFetchEmail(imap,headerOnly,1,0,email)
If success = 0
Debug CkImap::ckLastErrorText(imap)
CkImap::ckDispose(imap)
CkEmail::ckDispose(email)
ProcedureReturn
EndIf
CkImap::ckDispose(imap)
CkEmail::ckDispose(email)
ProcedureReturn
EndProcedure