(PowerBuilder) Add Content-Length Header to a MIME Message
The AddContentLength method automatically computes the length of the MIME content and adds a Content-Length header with the correct number of bytes.
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
// Use "Chilkat_9_5_0.Mime" for versions of Chilkat < 10.0.0
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
|