PureBasic
PureBasic
Check Whether an Email Is a multipart/report
See more Email Object Examples
Demonstrates the Chilkat Email.IsMultipartReport method, which returns true when the top-level message structure is a multipart/report (such as a bounce/DSN or a read receipt/MDN). This example loads an email and reports whether it is a multipart/report.
Background: Automated mail — delivery failures and read receipts — arrives wrapped in the
multipart/report structure, which carries machine-readable report parts. Detecting it with IsMultipartReport is the first step in a bounce-handling pipeline: once you know a message is a report, you can pull its parts with GetReport or read delivery fields with GetDeliveryStatusInfo to act on failures automatically.Chilkat PureBasic Downloads
IncludeFile "CkEmail.pb"
Procedure ChilkatExample()
success.i = 0
; Demonstrates the IsMultipartReport method, which returns true if the top-level message
; structure is a multipart/report (such as a bounce / DSN or a read receipt / MDN).
email.i = CkEmail::ckCreate()
If email.i = 0
Debug "Failed to create object."
ProcedureReturn
EndIf
success = CkEmail::ckLoadEml(email,"qa_data/eml/dsn_bounce.eml")
If success = 0
Debug CkEmail::ckLastErrorText(email)
CkEmail::ckDispose(email)
ProcedureReturn
EndIf
If CkEmail::ckIsMultipartReport(email) = 1
Debug "This email is a multipart/report (e.g. a bounce or read receipt)."
Else
Debug "This email is not a multipart/report."
EndIf
; Note: The path "qa_data/..." is a relative local filesystem path,
; relative to the current working directory of the running application.
CkEmail::ckDispose(email)
ProcedureReturn
EndProcedure