DataFlex
DataFlex
Serialize MIME to a String
See more MIME Examples
Demonstrates the Chilkat Mime.GetMime method, which serializes and returns the complete MIME entity — headers, body, multipart boundaries, and all descendants — as a string. It takes no arguments.
Background: This produces the finished MIME text ready to send, store, or hand to another component — the inverse of loading. The whole tree is emitted, including generated multipart boundaries. Because it returns a string, it is best for text-safe content; when the body may contain raw binary bytes, serialize with
GetMimeBd to a BinData instead so nothing is altered.Chilkat DataFlex Downloads
Use ChilkatAx-win32.pkg
Procedure Test
Boolean iSuccess
Handle hoMime
String sMimeText
String sTemp1
Boolean bTemp1
Move False To iSuccess
// Demonstrates the Mime.GetMime method, which serializes and returns the complete MIME entity
// (headers, body, multipart boundaries, and all descendants) as a string. It takes no
// arguments.
Get Create (RefClass(cComChilkatMime)) To hoMime
If (Not(IsComObjectCreated(hoMime))) Begin
Send CreateComObject of hoMime
End
// Build a simple MIME entity.
Get ComSetBodyFromPlainText Of hoMime "Hello, this is the message body." To iSuccess
If (iSuccess = False) Begin
Get ComLastErrorText Of hoMime To sTemp1
Showln sTemp1
Procedure_Return
End
// Serialize it to a string.
Get ComGetMime Of hoMime To sMimeText
Get ComLastMethodSuccess Of hoMime To bTemp1
If (bTemp1 = False) Begin
Get ComLastErrorText Of hoMime To sTemp1
Showln sTemp1
Procedure_Return
End
Showln sMimeText
End_Procedure