A new method will soon be added to the Chilkat Mailman class: VerifyRecipients. Here is an example in C#, with an explanation:
If you would like a pre-release with this new functionality, send email to support@chilkatsoft.com.
Verify email address via an SMTP session with the mailman.VerifyRecipients method.
Setup your mailman and email just like you normally would. Instead of calling SendEmail,
call VerifyRecipients to connect to the SMTP server and start the mail sending session.
In the SMTP protocol, "RCPT TO" commands are sent to the SMTP server, one per email address.
For each "RCPT TO" failure response, the email address is recorded in the output Chilkat.StringArray.
The SMTP session is aborted right after the final "RCPT TO" command, and prior to sending the "DATA"
command. Thus, the email is never sent. Your program may then examine the bad email addresses
and take appropriate action. Note: Some SMTP servers may accept *anything* for a "RCPT TO" argument,
and the level of email address checking varies with different SMTP servers.
<font face=courier size=1>
Chilkat.MailMan mailman = new Chilkat.MailMan();
mailman.UnlockComponent("30-day trial");
mailman.SmtpUsername = "mylogin@gmail.com";
mailman.SmtpPassword = "mypassword";
mailman.SmtpHost = "smtp.gmail.com";
mailman.SmtpPort = 465;
mailman.SmtpSsl = true;
Chilkat.Email email = new Chilkat.Email();
email.Subject = "this is a test";
email.Body = "This is a test…";
email.From = "chilkat.support@gmail.com";
email.AddTo("Matt","support@chilkatsoft.com");
email.AddTo("Junk","akls8dfgkd@a8dsagas.asdsas88fdfkd.com");
email.AddTo("kasdfas","8drsg8r**$$$");
Chilkat.StringArray array = new Chilkat.StringArray();
mailman.VerifyRecipients(email,array);
mailman.SaveLastError("verifyLog.txt");
// Print the bad email addresses.
int i;
int n = array.Count;
for (i=0; i<n ; i++)
{
listBox1.Items.Add(array.GetString(i));
}
</font>