PowerBuilder
PowerBuilder
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 PowerBuilder Downloads
integer li_rc
integer li_Success
oleobject loo_Mime
string ls_MimeText
li_Success = 0
// 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.
loo_Mime = create oleobject
li_rc = loo_Mime.ConnectToNewObject("Chilkat.Mime")
if li_rc < 0 then
destroy loo_Mime
MessageBox("Error","Connecting to COM object failed")
return
end if
// Build a simple MIME entity.
li_Success = loo_Mime.SetBodyFromPlainText("Hello, this is the message body.")
if li_Success = 0 then
Write-Debug loo_Mime.LastErrorText
destroy loo_Mime
return
end if
// Serialize it to a string.
ls_MimeText = loo_Mime.GetMime()
if loo_Mime.LastMethodSuccess = 0 then
Write-Debug loo_Mime.LastErrorText
destroy loo_Mime
return
end if
Write-Debug ls_MimeText
destroy loo_Mime