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
Service
PPMD
Deflate
DH Key Exchange
DSA

Byte Array
VB.NET FTPS
System.IO

Unreleased...
Bzip2
LZW
Bz2
Icon

 

 

 

 

 

 

Send Email with Abort

Download Chilkat .NET for 2.0 / 3.5 Framework

Download Chilkat .NET for 1.0 / 1.1 Framework

VB.NET sample code to abort the mail sending process in midstream.

    ' If we want to use events, we must declare the mailman as a member of the class.
    Private WithEvents mailman As New Chilkat.MailMan()

    ' This is the event callback.
    Private Sub mailman_OnSendPercentDone(ByVal sender As Object, ByVal args As Chilkat.MailPercentDoneEventArgs) Handles mailman.OnSendPercentDone
        ' args.PercentDone is an integer value indicating the percent done (1 to 100)

        ' args.Abort is an output argument.  If we set it to True the mail sending will
        ' be aborted.  In this example, we'll abort after the mail is 50% sent...
        ProgressBar1.Value = args.PercentDone
        If (args.PercentDone >= 50) Then
            args.Abort = True
        End If
    End Sub

    Private Sub Button3_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button3.Click

        mailman.UnlockComponent("Anything for 30-day trial")

        ' We need to enable events to get the callbacks...
        mailman.EnableEvents = True

        mailman.SmtpHost = "smtp.comcast.net"

        Dim email As New Chilkat.Email
        email.AddTo("Chilkat Support", "support@chilkatsoft.com")
        email.From = "Matt Fausey <fausey@chilkatsoft.com>"

        email.Subject = "This is a test"
        email.SetHtmlBody("<html><body><h1>This is a test</h1><p>Hello World!</p></body></html>")

        ' Add some file attachments...
        email.AddFileAttachment("dude.gif")
        email.AddFileAttachment("dude2.gif")

        Dim success As Boolean
        success = mailman.SendEmail(email)

        If (Not success) Then
            MessageBox.Show(mailman.LastErrorText)
        End If

    End Sub




 

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

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

Mail Component · XML Parser