PowerBuilder Requires Chilkat v11.0.0+
PowerBuilder
Create an inline forward
See more Email Object Examples
Create a forward from a saved email, set the forwarding author and destination, and inspect the generated subject and body. Save the draft before submitting it to SMTP. To introduce the original with a separate cover note, use the attached-message example.
Chilkat PowerBuilder Downloads
integer li_rc
long li_Success
oleobject loo_Original
oleobject loo_Forward
li_Success = 0
// Assumes Chilkat is unlocked. See Global Unlock Sample.
loo_Original = create oleobject
li_rc = loo_Original.ConnectToNewObject("Chilkat.Email")
if li_rc < 0 then
destroy loo_Original
MessageBox("Error","Connecting to COM object failed")
return
end if
li_Success = loo_Original.LoadEml("alternatives.eml")
if li_Success <> 1 then
Write-Debug loo_Original.LastErrorText
destroy loo_Original
return
end if
loo_Forward = create oleobject
li_rc = loo_Forward.ConnectToNewObject("Chilkat.Email")
li_Success = loo_Original.ToForward(loo_Forward)
if li_Success <> 1 then
Write-Debug loo_Original.LastErrorText
destroy loo_Original
destroy loo_Forward
return
end if
loo_Forward.From = "Workshop team <events@example.com>"
li_Success = loo_Forward.AddTo("Coordinator","coordinator@example.net")
if li_Success <> 1 then
Write-Debug loo_Forward.LastErrorText
destroy loo_Original
destroy loo_Forward
return
end if
Write-Debug loo_Forward.Subject
if loo_Forward.HasHtmlBody() = 1 then
Write-Debug loo_Forward.GetHtmlBody()
else
Write-Debug loo_Forward.GetPlainTextBody()
end if
li_Success = loo_Forward.SaveEml("forward.eml")
if li_Success <> 1 then
Write-Debug loo_Forward.LastErrorText
destroy loo_Original
destroy loo_Forward
return
end if
Write-Debug "Saved forward.eml."
destroy loo_Original
destroy loo_Forward