Visual Basic Examples

ChilkatHOMEASPVisual BasicVB.NETC#Visual C++CMFCDelphiFoxProJavaPerlPHPPythonRubySQL ServerVBScript

VB Examples

Bounced Mail
Bz2
Character Encoding
CSV
Digital Certificates
Digital Signatures
Email
FTP
HTML-to-XML
HTTP
IMAP
Encryption
MHT / HTML Email
POP3
RSA
S/MIME
SFTP
SMTP
Socket
Spider
SSH
SSH Key
SSH Tunnel
String
Tar
Unicode
Upload
XML
XMP
Zip Compression

More Examples...
Email Object
DKIM / DomainKey
NTLM
DH Key Exchange
DSA
FileAccess
RSS
Atom
Self-Extractor
Service
Bzip2
PPMD
Deflate
LZW


VB Strings
VB Byte Array

 

 

 

 

 

 

 

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

'  The mailman object is used for sending and receiving email.
Dim mailman As New ChilkatMailMan2

'  Any string argument automatically begins the 30-day trial.
Dim success As Long
success = mailman.UnlockComponent("30-day trial")
If (success <> 1) Then
    MsgBox "Component unlock failed"
    Exit Sub
End If

'  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 = "****";

mailman.SmtpHost = "smtp.comcast.net"

'  Create an email object.
'  We'll never actually send this email.  It's only used
'  to test the recipients.
Dim email As New ChilkatEmail2

email.Subject = "This is a test"
email.Body = "This is a test"
email.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.)
email.AddTo "A Real Person","a_real_person@comcast.net"
email.AddTo "Testing","doesNotExist7434@comcast.net"
email.AddTo "Admin","admin@chilkatsoft.com"
email.AddTo "Not Exist","doesNotExist@chilkatsoft.com"
email.AddCC "Not Exist","DoesNotExist7213@gmail.com"
email.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:
Dim saBadAddrs As CkStringArray
Set saBadAddrs = mailman.VerifyRecipients(email)
If (saBadAddrs Is Nothing ) Then
    MsgBox mailman.LastErrorText

Else
    '  List the invalid email addresses:
    If (saBadAddrs.Count > 0) Then
        Dim i As Long
        Dim n As Long
        n = saBadAddrs.Count
        For i = 0 To n - 1
            Text1.Text = Text1.Text & saBadAddrs.GetString(i) & vbCrLf
        Next

        '  Examine the SMTP session log to see how the email
        '  addresses were caught:
        MsgBox mailman.SmtpSessionLog

    End If
End If

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

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