Tcl Requires Chilkat v11.0.0+
Tcl
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 Tcl Downloads
load ./chilkat.dll
set success 0
# Assumes Chilkat is unlocked. See Global Unlock Sample.
set email [new_CkEmail]
CkEmail_put_From $email "Sam Lee <sam@example.com>"
set success [CkEmail_AddTo $email "Alex Rivera" "alex@example.net"]
if {$success != 1} then {
puts [CkEmail_lastErrorText $email]
delete_CkEmail $email
exit
}
CkEmail_put_Subject $email "Hello"
CkEmail_put_Body $email "This is a plain-text message."
set success [CkEmail_SaveEml $email "message.eml"]
if {$success != 1} then {
puts [CkEmail_lastErrorText $email]
delete_CkEmail $email
exit
}
set received [new_CkEmail]
set success [CkEmail_LoadEml $received "message.eml"]
if {$success != 1} then {
puts [CkEmail_lastErrorText $received]
delete_CkEmail $email
delete_CkEmail $received
exit
}
puts [CkEmail_from $received]
puts [CkEmail_subject $received]
puts [CkEmail_getPlainTextBody $received]
delete_CkEmail $email
delete_CkEmail $received