PowerBuilder
PowerBuilder
MIME Content Part Descriptor Properties
See more MIME Examples
Demonstrates the properties that describe an individual MIME content part: Charset (the charset parameter of Content-Type), Encoding (the Content-Transfer-Encoding), Disposition (the Content-Disposition value), Filename (the filename parameter of Content-Disposition), and Name (the name parameter of Content-Type). Each is set and then read back, and the effect is visible in the serialized MIME header.
Background. These properties operate on the current MIME entity's header fields. Filename and Name are receiver-facing labels, not local filesystem paths, and Charset is meaningful for text parts.
Chilkat PowerBuilder Downloads
integer li_rc
integer li_Success
oleobject loo_Mime
string ls_MimeStr
li_Success = 0
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
li_Success = loo_Mime.SetBodyFromPlainText("The quick brown fox.")
if li_Success = 0 then
Write-Debug loo_Mime.LastErrorText
destroy loo_Mime
return
end if
// Charset is the charset parameter of the Content-Type header field (meaningful for text parts).
loo_Mime.Charset = "utf-8"
// Encoding is the Content-Transfer-Encoding for this part.
loo_Mime.Encoding = "quoted-printable"
// Disposition, Filename, and Name describe how a receiver should present the part.
// Filename is the filename parameter of Content-Disposition; Name is the name parameter of
// Content-Type. Both are receiver-facing names, not local filesystem paths.
loo_Mime.Disposition = "attachment"
loo_Mime.Filename = "note.txt"
loo_Mime.Name = "note.txt"
// Read the descriptors back.
Write-Debug "Charset = " + loo_Mime.Charset
Write-Debug "Encoding = " + loo_Mime.Encoding
Write-Debug "Disposition = " + loo_Mime.Disposition
Write-Debug "Filename = " + loo_Mime.Filename
Write-Debug "Name = " + loo_Mime.Name
// The descriptors appear in the serialized MIME header.
ls_MimeStr = loo_Mime.GetMime()
if loo_Mime.LastMethodSuccess = 0 then
Write-Debug loo_Mime.LastErrorText
destroy loo_Mime
return
end if
Write-Debug ls_MimeStr
destroy loo_Mime