VB.NET Examples

ChilkatHOMEASPVisual BasicVB.NETC#Visual C++DelphiFoxProJavaPerlPythonRubySQL ServerVBScript

Visual FoxPro Examples

Bounced Mail
Character Encoding
Digital Certificates
Digital Signatures
Email
FTP
HTML-to-XML
HTTP
IMAP
Encryption
MHT / HTML Email
RSA Encryption
S/MIME
Socket
Spider
String
Tar
Upload
XML
XMP
Zip Compression
Self-Extractor

More Examples...
Email Object
POP3
SMTP
RSS
Atom
Byte Array

Unreleased...
Service
PPMD
Deflate
Bzip2
LZW
Bz2
DH Key Exchange
DSA
Icon

 

Non-Chilkat Links
Text and String Handling

Verify Email Addresses with VerifyRecipients

Verify email recipients. This example demonstrates the usage of the VerifyRecipients method.

Please see this blog post for more information VerifyRecipients -- Validating Email Addresses

Download Chilkat Email ActiveX for POP3 / SMTP

Download Chilkat IMAP ActiveX

LOCAL loMailman
LOCAL lnSuccess
LOCAL loEmail
LOCAL loSaBadAddrs
LOCAL i
LOCAL n

*  The mailman object is used for sending and receiving email.
loMailman = CreateObject('Chilkat.MailMan2')

*  Any string argument automatically begins the 30-day trial.

lnSuccess = loMailman.UnlockComponent("30-day trial")
IF (lnSuccess <> 1) THEN
    =MESSAGEBOX("Component unlock failed")
    QUIT
ENDIF

*  Set the SMTP server.
*  This code was tested against both mail.chilkatsoft.com
*  and smtp.comcast.net

*  mailman.SmtpHost = "mail.chilkatsoft.com";
*  mailman.SmtpUsername = "admin@chilkatsoft.com";
*  mailman.SmtpPassword = "****";

loMailman.SmtpHost = "smtp.comcast.net"

*  Create an email object.
*  We'll never actually send this email.  It's only used
*  to test the recipients.
loEmail = CreateObject('Chilkat.Email2')

loEmail.Subject = "This is a test"
loEmail.Body = "This is a test"
loEmail.From = "Chilkat Support <support@chilkatsoft.com>"

*  Add recipients to be checked.
*  (When this was tested, a_real_person was replaced with
*  a valid email address.)
loEmail.AddTo("A Real Person","a_real_person@comcast.net")
loEmail.AddTo("Testing","doesNotExist7434@comcast.net")
loEmail.AddTo("Admin","admin@chilkatsoft.com")
loEmail.AddTo("Not Exist","doesNotExist@chilkatsoft.com")
loEmail.AddCC("Not Exist","DoesNotExist7213@gmail.com")
loEmail.AddBcc("Exists","chilkat.support@gmail.com")

*  NOTE: A mail server can only verify the email addresses
*  specific to it's domain.  Therefore, when using smtp.comcast.net,
*  only comcast.net email addresses will be flagged as invalid,
*  and when using mail.chilkatsoft.com, only chilkatsoft.com
*  email addresses are flagged as invalid.

*  Return all bad email addresses in saBadAddrs:

loSaBadAddrs = loMailman.VerifyRecipients(loEmail)
IF (loSaBadAddrs = NULL ) THEN
    =MESSAGEBOX(loMailman.LastErrorText)

ELSE
    *  List the invalid email addresses:
    IF (loSaBadAddrs.Count > 0) THEN

        n = loSaBadAddrs.Count
        FOR i = 0 TO n - 1
            ? loSaBadAddrs.GetString(i)
        NEXT

        *  Examine the SMTP session log to see how the email
        *  addresses were caught:
        =MESSAGEBOX(loMailman.SmtpSessionLog)

        RELEASE loSaBadAddrs
    ENDIF
ENDIF

Need a specific example? Send a request to support@chilkatsoft.com

© 2000-2007 Chilkat Software, Inc. All Rights Reserved.

Mail Component · .NET Email Component · ASP Mail Component · XML Parser