DataFlex
DataFlex
Load MIME from a String
See more MIME Examples
Demonstrates the Chilkat Mime.LoadMime method, which parses complete MIME text and replaces the current object's headers, body, and multipart tree. The only argument is the MIME string.
Background: MIME is the structure behind email messages and many other content containers — a set of headers, a blank line, then a body that may itself be a tree of nested parts. Loading parses that text into an object you can then inspect and modify part by part. A successful load fully replaces whatever the object held before, and Chilkat is tolerant of common real-world formatting quirks. When the content may contain raw 8-bit or NUL bytes, prefer
LoadMimeBd so nothing is forced through a text string.Chilkat DataFlex Downloads
Use ChilkatAx-win32.pkg
Procedure Test
Boolean iSuccess
Handle hoMime
String sMimeText
String sTemp1
Move False To iSuccess
// Demonstrates the Mime.LoadMime method, which parses complete MIME text and replaces the current
// object's headers, body, and multipart tree. The only argument is the MIME string.
Get Create (RefClass(cComChilkatMime)) To hoMime
If (Not(IsComObjectCreated(hoMime))) Begin
Send CreateComObject of hoMime
End
// The complete MIME text (headers, a blank line, then the body).
Move "Content-Type: text/plain" + (character(13)) + (character(10)) + (character(13)) + (character(10)) + "This is the body." + (character(13)) + (character(10)) To sMimeText
Get ComLoadMime Of hoMime sMimeText To iSuccess
If (iSuccess = False) Begin
Get ComLastErrorText Of hoMime To sTemp1
Showln sTemp1
Procedure_Return
End
Get ComContentType Of hoMime To sTemp1
Showln "Content-Type: " sTemp1
End_Procedure