DataFlex Requires Chilkat v11.0.0+
DataFlex
Create, save, and reopen a plain-text email
See more Email Object Examples
Set the sender, recipient, subject, and plain-text body. Save the result as an EML file, then open it in a second Email object and read its contents.
Chilkat DataFlex Downloads
Use ChilkatAx-win32.pkg
Procedure Test
Boolean iSuccess
Handle hoEmail
Handle hoReceived
String sTemp1
Move False To iSuccess
// Assumes Chilkat is unlocked. See Global Unlock Sample.
Get Create (RefClass(cComChilkatEmail)) To hoEmail
If (Not(IsComObjectCreated(hoEmail))) Begin
Send CreateComObject of hoEmail
End
Set ComFrom Of hoEmail To "Sam Lee <sam@example.com>"
Get ComAddTo Of hoEmail "Alex Rivera" "alex@example.net" To iSuccess
If (iSuccess <> True) Begin
Get ComLastErrorText Of hoEmail To sTemp1
Showln sTemp1
Procedure_Return
End
Set ComSubject Of hoEmail To "Hello"
Set ComBody Of hoEmail To "This is a plain-text message."
Get ComSaveEml Of hoEmail "message.eml" To iSuccess
If (iSuccess <> True) Begin
Get ComLastErrorText Of hoEmail To sTemp1
Showln sTemp1
Procedure_Return
End
Get Create (RefClass(cComChilkatEmail)) To hoReceived
If (Not(IsComObjectCreated(hoReceived))) Begin
Send CreateComObject of hoReceived
End
Get ComLoadEml Of hoReceived "message.eml" To iSuccess
If (iSuccess <> True) Begin
Get ComLastErrorText Of hoReceived To sTemp1
Showln sTemp1
Procedure_Return
End
Get ComFrom Of hoReceived To sTemp1
Showln sTemp1
Get ComSubject Of hoReceived To sTemp1
Showln sTemp1
Get ComGetPlainTextBody Of hoReceived To sTemp1
Showln sTemp1
End_Procedure