PowerBuilder
PowerBuilder
Add Content-Length Header to a MIME Message
See more MIME Examples
The AddContentLength method automatically computes the length of the MIME content and adds a Content-Length header with the correct number of bytes.Chilkat PowerBuilder Downloads
integer li_rc
oleobject loo_Mime
// This example assumes the Chilkat API to have been previously unlocked.
// See Global Unlock Sample for sample code.
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
// Set the MIME body:
loo_Mime.SetBody("This is a test")
// The complete size (in bytes) of the contents is computed,
// even if the MIME is multipart, and the Content-Length header
// is added.
loo_Mime.AddContentLength()
// Display the MIME:
Write-Debug loo_Mime.GetMime()
destroy loo_Mime