PowerBuilder
PowerBuilder
Load MIME from a StringBuilder
See more MIME Examples
Demonstrates the Chilkat Mime.LoadMimeSb method, which parses complete MIME text from a StringBuilder and replaces the current MIME. The only argument is the StringBuilder.
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: When the MIME text already lives in a
StringBuilder — assembled in memory, or read and lightly edited — this loads it directly without an intermediate string copy. Its parsing behavior matches LoadMime; the difference is purely the source. For content that might include arbitrary binary bytes, use the BinData loader instead.Chilkat PowerBuilder Downloads
integer li_rc
integer li_Success
oleobject loo_Sb
oleobject loo_Mime
li_Success = 0
// Demonstrates the Mime.LoadMimeSb method, which parses complete MIME text from a StringBuilder
// and replaces the current MIME. The only argument is the StringBuilder.
// Put the MIME text into a StringBuilder (here loaded from a file, but it could come from
// anywhere).
loo_Sb = create oleobject
li_rc = loo_Sb.ConnectToNewObject("Chilkat.StringBuilder")
if li_rc < 0 then
destroy loo_Sb
MessageBox("Error","Connecting to COM object failed")
return
end if
li_Success = loo_Sb.LoadFile("qa_data/message.eml","utf-8")
if li_Success = 0 then
Write-Debug loo_Sb.LastErrorText
destroy loo_Sb
return
end if
loo_Mime = create oleobject
li_rc = loo_Mime.ConnectToNewObject("Chilkat.Mime")
li_Success = loo_Mime.LoadMimeSb(loo_Sb)
if li_Success = 0 then
Write-Debug loo_Mime.LastErrorText
destroy loo_Sb
destroy loo_Mime
return
end if
Write-Debug "Content-Type: " + loo_Mime.ContentType
destroy loo_Sb
destroy loo_Mime