Xbase++
Xbase++
Create a multipart/mixed MIME Entity
See more MIME Examples
Demonstrates the Chilkat Mime.NewMultipartMixed method, which initializes the object as an empty multipart/mixed entity, clearing any existing content. It takes no arguments; child parts are then appended.
Note: The file paths are relative to the application's current working directory. Absolute paths may also be used. Supply the paths appropriate to your own environment.
Background:
multipart/mixed is the container for independent parts shown one after another — the classic "message body plus attachments" layout. Each child is its own distinct content, unlike multipart/alternative (competing renderings of the same thing) or multipart/related (a part and its embedded resources). Start here, then AppendPart a body and AppendPartFromFile the attachments.Chilkat Xbase++ Downloads
LOCAL nSuccess
LOCAL oMime
LOCAL oBodyPart
nSuccess := 0
// Demonstrates the Mime.NewMultipartMixed method, which initializes the object as an empty
// multipart/mixed entity, clearing any existing headers, body, and child parts. It takes no
// arguments.
oMime := CreateObject("Chilkat.Mime")
nSuccess := oMime:NewMultipartMixed()
IF (nSuccess == 0)
? oMime:LastErrorText
oMime:destroy()
RETURN
ENDIF
// Append child parts. multipart/mixed is the container for a message body plus attachments.
oBodyPart := CreateObject("Chilkat.Mime")
nSuccess := oBodyPart:SetBodyFromPlainText("See the attached report.")
IF (nSuccess == 0)
? oBodyPart:LastErrorText
oMime:destroy()
oBodyPart:destroy()
RETURN
ENDIF
nSuccess := oMime:AppendPart(oBodyPart)
IF (nSuccess == 0)
? oMime:LastErrorText
oMime:destroy()
oBodyPart:destroy()
RETURN
ENDIF
nSuccess := oMime:AppendPartFromFile("qa_data/report.pdf")
IF (nSuccess == 0)
? oMime:LastErrorText
oMime:destroy()
oBodyPart:destroy()
RETURN
ENDIF
? "Number of parts: " + Str(oMime:NumParts)
oMime:destroy()
oBodyPart:destroy()