VBScript Examples

ChilkatHOMEASPVisual BasicVB.NETC#Visual C++CMFCDelphiFoxProJavaPerlPHPPythonRubySQL ServerVBScript

VBScript 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
String
Tar
Upload
XML
XMP
Zip Compression
Self-Extractor

More Examples...
Email Object
POP3
SMTP
Byte Array
RSS
Atom
Service
PPMD
Deflate
DH Key Exchange
DSA
SSH Key
SSH
SSH Tunnel
SFTP

Unreleased...
Bzip2
LZW
Bz2
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 Email ActiveX for POP3 / SMTP

Download Chilkat IMAP ActiveX

Dim fso, outFile
Set fso = CreateObject("Scripting.FileSystemObject")
Set outFile = fso.CreateTextFile("output.txt", True)

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

'  Any string argument automatically begins the 30-day trial.
success = mailman.UnlockComponent("30-day trial")
If (success <> 1) Then
    MsgBox "Component unlock failed"
    WScript.Quit
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.
set email = CreateObject("Chilkat.Email2")

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:

Set saBadAddrs = mailman.VerifyRecipients(email)
If (saBadAddrs Is Nothing ) Then
    MsgBox mailman.LastErrorText

Else
    '  List the invalid email addresses:
    If (saBadAddrs.Count > 0) Then

        n = saBadAddrs.Count
        For i = 0 To n - 1
            outFile.WriteLine(saBadAddrs.GetString(i))
        Next

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

    End If
End If

outFile.Close

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

© 2003-2008 Chilkat Software, Inc. All Rights Reserved.

Mail Component · XML Parser