PureBasic
PureBasic
Transition from MailMan.FetchByMsgnum to MailMan.FetchOne
Provides instructions for replacing deprecated FetchByMsgnum method calls with FetchOne.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
; ...
; ...
msgnum.i = 123
; ------------------------------------------------------------------------
; The FetchByMsgnum method is deprecated:
emailObj.i = CkMailMan::ckFetchByMsgnum(mailman,msgnum)
If CkMailMan::ckLastMethodSuccess(mailman) = 0
Debug CkMailMan::ckLastErrorText(mailman)
CkMailMan::ckDispose(mailman)
ProcedureReturn
EndIf
; ...
; ...
CkEmail::ckDispose(emailObj)
; ------------------------------------------------------------------------
; Do the equivalent using FetchOne.
; 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::ckFetchOne(mailman,headerOnly,numBodyLines,msgnum,emailOut)
If success = 0
Debug CkMailMan::ckLastErrorText(mailman)
CkMailMan::ckDispose(mailman)
CkEmail::ckDispose(emailOut)
ProcedureReturn
EndIf
CkMailMan::ckDispose(mailman)
CkEmail::ckDispose(emailOut)
ProcedureReturn
EndProcedure