VB.NET Examples

ChilkatHOMEASPVisual BasicVB.NETC#Visual C++CMFCDelphiFoxProJavaPerlPHPPythonRubySQL ServerVBScript

VB.NET Examples

Bounced Mail
Character Encoding
Digital Certificates
Digital Signatures
Email
FTP
HTML to XML
HTTP
IMAP
Encryption
MHT / HTML Email
PFX
RSA Encryption
S/MIME
Socket
Spider
Tar Archive
Upload
XML
XMP
Zip Compression
Misc

More Examples...
Email Object
POP3
SMTP
RSS
Atom
Self-Extractor

Byte Array
VB.NET FTPS
System.IO

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

 

 

 

 

 

 

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 .NET for 2.0 Framework

Download Chilkat .NET for 1.0 / 1.1 Framework

'  The mailman object is used for sending and receiving email.
Dim mailman As New Chilkat.MailMan()

'  Any string argument automatically begins the 30-day trial.
Dim success As Boolean
success = mailman.UnlockComponent("30-day trial")
If (success <> true) 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 Chilkat.Email()

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.

'  Add all bad email addresses to saBadAddrs:
Dim saBadAddrs As New Chilkat.StringArray()
success = mailman.VerifyRecipients(email,saBadAddrs)
If (success <> true) 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
            TextBox1.Text = TextBox1.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-2007 Chilkat Software, Inc. All Rights Reserved.

Mail Component · XML Parser