DataFlex
DataFlex
Send to a File-Based Distribution List
See more Email Object Examples
Demonstrates the Chilkat Email.FileDistList property. Set this property to send an email to a list of recipients stored in a plain-text file — one recipient per line, blank lines ignored, no comments. Setting it is equivalent to adding a CKX-FileDistList header field. When the email is sent, MailMan reads the file and delivers to each recipient. This example sets the distribution-list file and prints the MIME.
Background: MIME headers whose names start with
X- are non-standard, application-specific fields. Chilkat extends this idea with its own CKX- prefix: these fields let you attach instructions to an email object that Chilkat understands, but they are stripped before transmission so they never appear in the delivered message. They are preserved when you save/load the email as XML or MIME, making them handy for storing send-time metadata like a distribution list.Chilkat DataFlex Downloads
Use ChilkatAx-win32.pkg
Procedure Test
Handle hoEmail
String sTemp1
// Demonstrates the Email.FileDistList property.
// Setting this property causes MailMan to send the email to a list of
// recipients stored in a plain-text file (one recipient per line).
// Setting it is equivalent to adding a CKX-FileDistList header field.
Get Create (RefClass(cComChilkatEmail)) To hoEmail
If (Not(IsComObjectCreated(hoEmail))) Begin
Send CreateComObject of hoEmail
End
Set ComSubject Of hoEmail To "Newsletter"
Set ComBody Of hoEmail To "Hello subscribers!"
Set ComFrom Of hoEmail To "news@example.com"
// The file contains one recipient email address per line.
Set ComFileDistList Of hoEmail To "qa_data/txt/recipients.txt"
Get ComFileDistList Of hoEmail To sTemp1
Showln "FileDistList = " sTemp1
// The CKX-FileDistList header field is present in the saved MIME, but CKX-
// fields are never transmitted when the email is actually sent.
Get ComGetMime Of hoEmail To sTemp1
Showln sTemp1
End_Procedure