DataFlex Requires Chilkat v11.0.0+
DataFlex
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 DataFlex Downloads
Use ChilkatAx-win32.pkg
Procedure Test
Boolean iSuccess
Handle hoOriginal
Variant vForward
Handle hoForward
String sTemp1
Boolean bTemp1
Move False To iSuccess
// Assumes Chilkat is unlocked. See Global Unlock Sample.
Get Create (RefClass(cComChilkatEmail)) To hoOriginal
If (Not(IsComObjectCreated(hoOriginal))) Begin
Send CreateComObject of hoOriginal
End
Get ComLoadEml Of hoOriginal "alternatives.eml" To iSuccess
If (iSuccess <> True) Begin
Get ComLastErrorText Of hoOriginal To sTemp1
Showln sTemp1
Procedure_Return
End
Get Create (RefClass(cComChilkatEmail)) To hoForward
If (Not(IsComObjectCreated(hoForward))) Begin
Send CreateComObject of hoForward
End
Get pvComObject of hoForward to vForward
Get ComToForward Of hoOriginal vForward To iSuccess
If (iSuccess <> True) Begin
Get ComLastErrorText Of hoOriginal To sTemp1
Showln sTemp1
Procedure_Return
End
Set ComFrom Of hoForward To "Workshop team <events@example.com>"
Get ComAddTo Of hoForward "Coordinator" "coordinator@example.net" To iSuccess
If (iSuccess <> True) Begin
Get ComLastErrorText Of hoForward To sTemp1
Showln sTemp1
Procedure_Return
End
Get ComSubject Of hoForward To sTemp1
Showln sTemp1
Get ComHasHtmlBody Of hoForward To bTemp1
If (bTemp1 = True) Begin
Get ComGetHtmlBody Of hoForward To sTemp1
Showln sTemp1
End
Else Begin
Get ComGetPlainTextBody Of hoForward To sTemp1
Showln sTemp1
End
Get ComSaveEml Of hoForward "forward.eml" To iSuccess
If (iSuccess <> True) Begin
Get ComLastErrorText Of hoForward To sTemp1
Showln sTemp1
Procedure_Return
End
Showln "Saved forward.eml."
End_Procedure