Sample code for 30+ languages & platforms
PowerBuilder

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 PowerBuilder Downloads

PowerBuilder
integer li_rc
integer li_Success
oleobject loo_Email

li_Success = 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).

loo_Email = create oleobject
li_rc = loo_Email.ConnectToNewObject("Chilkat.Email")
if li_rc < 0 then
    destroy loo_Email
    MessageBox("Error","Connecting to COM object failed")
    return
end if

li_Success = loo_Email.LoadEml("qa_data/eml/dsn_bounce.eml")
if li_Success = 0 then
    Write-Debug loo_Email.LastErrorText
    destroy loo_Email
    return
end if

if loo_Email.IsMultipartReport() = 1 then
    Write-Debug "This email is a multipart/report (e.g. a bounce or read receipt)."
else
    Write-Debug "This email is not a multipart/report."
end if

//  Note: The path "qa_data/..." is a relative local filesystem path,
//  relative to the current working directory of the running application.


destroy loo_Email