PowerBuilder
PowerBuilder
Create an Inline-Forward Email
See more Email Object Examples
Demonstrates the Chilkat Email.ToForward method, which creates an inline-forward email based on this email. The forward is returned in the argument, and the source email is not modified. The returned email can be edited — adding recipients, prepending a note — before sending. This example forwards a message and adds a recipient.
Background: An inline forward quotes the original message's content within the body of the new message — the familiar "---------- Forwarded message ----------" style — as opposed to attaching the original as a
message/rfc822 part (which AttachEmail does). Chilkat assembles the quoted body and headers for you, leaving the new message ready to address and send.Chilkat PowerBuilder Downloads
integer li_rc
integer li_Success
oleobject loo_Email
oleobject loo_Fwd
li_Success = 0
// Demonstrates the ToForward method, which creates an inline-forward email based on this
// email. The forward is returned in the argument; the source email is not modified.
loo_Email = create oleobject
li_rc = loo_Email.ConnectToNewObject("Chilkat.Email")
if li_rc < 0 then
destroy loo_Email
MessageBox("Error","Connecting to COM object failed")
return
end if
loo_Email.Subject = "Quarterly results"
loo_Email.From = "alice@example.com"
loo_Email.AddTo("Bob","bob@example.com")
loo_Email.Body = "Here are the quarterly results."
// Create an inline-forward email from this message.
loo_Fwd = create oleobject
li_rc = loo_Fwd.ConnectToNewObject("Chilkat.Email")
li_Success = loo_Email.ToForward(loo_Fwd)
if li_Success = 0 then
Write-Debug loo_Email.LastErrorText
destroy loo_Email
destroy loo_Fwd
return
end if
// The forward can be edited to add recipients before sending.
loo_Fwd.AddTo("Carol","carol@example.com")
Write-Debug loo_Fwd.GetMime()
destroy loo_Email
destroy loo_Fwd