PureBasic
PureBasic
Transition from MailMan.FetchEmail to MailMan.FetchByUidl
Provides instructions for replacing deprecated FetchEmail method calls with FetchByUidl.Chilkat PureBasic Downloads
IncludeFile "CkEmail.pb"
IncludeFile "CkMailMan.pb"
Procedure ChilkatExample()
success.i = 0
mailman.i = CkMailMan::ckCreate()
If mailman.i = 0
Debug "Failed to create object."
ProcedureReturn
EndIf
; ...
; ...
uidl.s = "123"
; ------------------------------------------------------------------------
; The FetchEmail method is deprecated:
emailObj.i = CkMailMan::ckFetchEmail(mailman,uidl)
If CkMailMan::ckLastMethodSuccess(mailman) = 0
Debug CkMailMan::ckLastErrorText(mailman)
CkMailMan::ckDispose(mailman)
ProcedureReturn
EndIf
; ...
; ...
CkEmail::ckDispose(emailObj)
; ------------------------------------------------------------------------
; Do the equivalent using FetchByUidl.
; Your application creates a new, empty Email object which is passed
; in the last argument and filled upon success.
headerOnly.i = 0
; Irrelevant because we are not downloading headers-only.
numBodyLines.i = 0
emailOut.i = CkEmail::ckCreate()
If emailOut.i = 0
Debug "Failed to create object."
ProcedureReturn
EndIf
success = CkMailMan::ckFetchByUidl(mailman,uidl,headerOnly,numBodyLines,emailOut)
If success = 0
Debug CkMailMan::ckLastErrorText(mailman)
CkMailMan::ckDispose(mailman)
CkEmail::ckDispose(emailOut)
ProcedureReturn
EndIf
CkMailMan::ckDispose(mailman)
CkEmail::ckDispose(emailOut)
ProcedureReturn
EndProcedure