Visual Basic Examples

ChilkatHOMEAndroid™ASPVisual BasicVB.NETC#iOS (IPhone)Objective-CC++CMFCDelphiFoxProJavaPerl
PHP ExtensionPHP ActiveXPythonPowerShellRubySQL ServerVBScript

VB Examples

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

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


VB Strings
VB Byte Array

 

 

 

 

 

 

 

Zip Email Attachments and Send

Download Chilkat Email ActiveX

This VB6 example shows how to add attachments to an email and then Zip-compress them in-memory and send.


' This example demonstrates how to Zip attachments in an email.

Private Sub Browse_Click()
    CommonDialog1.ShowOpen
    AttachFile.Text = CommonDialog1.FileName
    List1.AddItem AttachFile.Text
End Sub

Private Sub Command1_Click()

    ' Create the mailman object for sending and receiving email.
    Dim mailman As New ChilkatMailMan2
    mailman.UnlockComponent MailUnlockCode.Text

    WorkingMsg.Caption = "Working..."
    WorkingMsg.Refresh
    
    ' Create a new mail object.
    Dim email As ChilkatEmail2
    Set email = New ChilkatEmail2
    
    email.Body = "This is a test"
    email.From = "matt@chilkatsoft.com"
    email.AddTo "Matt Fausey", "fausey@chilkatsoft.com"
    email.Subject = "Test"
    
    ' Add file attachments.
    For i = 0 To List1.ListCount - 1
        contentType = email.AddFileAttachment(List1.List(i))
    Next
    
    ' After calling ZipAttachments, all existing email attachments
    ' will now be contained in a single Zip-file attachment.
    email.ZipAttachments "attachments.zip"
    
    ' You can save the email as XML and examine it's structure.
    email.SaveXml "email.xml"
    
    ' Send the email, and save the log which can be checked for errors.
    ' SendEmail returns 1 for success and 0 for failure.
    mailman.SmtpHost = SmtpServer.Text
    success = mailman.SendEmail(email)
    If (success = 0) Then
        ' Failed
        MsgBox mailman.LastErrorText
    End If
    
    mailman.SaveLastError "log.xml"
    
    WorkingMsg.Caption = "Finished."

End Sub



 

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