Tcl
Tcl
Verify Email Recipients
A way to possibly determine valid/invalid email addresses. I would recommend being very careful about doing this because your IP address may be flagged as a potential spammer by the mail server (because you are probing for valid/invalid email addresses). This Chilkat functionality existed for many years, before this kind of activity became a problem. The functionality remains only because it is useful for some to test with their own SMTP servers.Chilkat Tcl Downloads
load ./chilkat.dll
set success 0
# This example requires the Chilkat API to have been previously unlocked.
# See Global Unlock Sample for sample code.
set mailman [new_CkMailMan]
# SMTP connection settings...
CkMailMan_put_SmtpHost $mailman "smtp.example.com"
CkMailMan_put_SmtpUsername $mailman "MY_SMTP_USERNAME"
CkMailMan_put_SmtpPassword $mailman "MY_SMTP_PASSWORD"
CkMailMan_put_SmtpSsl $mailman 1
CkMailMan_put_SmtpPort $mailman 465
# Create a new email object
set email [new_CkEmail]
CkEmail_put_Subject $email "This is a test"
CkEmail_put_Body $email "This is a test"
CkEmail_put_From $email "myemail@example.com"
set success [CkEmail_AddTo $email "person1" "person1@example.com"]
set success [CkEmail_AddTo $email "person2" "person2@example.com"]
set success [CkEmail_AddTo $email "person3" "person3@example.com"]
# The SMTP server smtp.example.com won't know anything about an email address @somewhere_else.com
set success [CkEmail_AddTo $email "person3" "person4@somewhere_else.com"]
# ...
# Verify recipients.
# **** See the warning about using this API method in the description above.
# (An SMTP server only knows valid email address for its own domain. For example,
# smtp.example.com *may* only know if person1@example.com is valid or invalid, but does
# not know anything about the validity of email addresses having other domains.)
set badAddrs [new_CkStringArray]
set success [CkMailMan_VerifyRecips $mailman $email $badAddrs]
if {$success != 1} then {
puts [CkMailMan_lastErrorText $mailman]
delete_CkMailMan $mailman
delete_CkEmail $email
delete_CkStringArray $badAddrs
exit
}
set i 0
while {$i < [CkStringArray_get_Count $badAddrs]} {
puts [CkStringArray_getString $badAddrs $i]
set i [expr $i + 1]
}
puts "done."
delete_CkMailMan $mailman
delete_CkEmail $email
delete_CkStringArray $badAddrs