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
FileAccess
RSS
Atom
Self-Extractor
Service
PPMD
Deflate
DH Key Exchange
DSA


VB Strings
VB Byte Array

Unreleased...
Bzip2
LZW
Icon

 

 

 

 

 

 

 

Send Mail with a GIF File Attachment

Download Chilkat Email ActiveX

(After installing, add a reference to "Chilkat Mail" in your VB6 project.)

Sends mail with a single file attachment.

' This Visual Basic example program sends mail with
' a GIF file attachment.
Private Sub SendMail_Click()

    ' Create a MailMan instance to send email
    Dim mailman As New ChilkatMailMan2
    ' Unlock the email component
    mailman.UnlockComponent "UnlockCode"
    
    ' Change this to your SMTP server.
    ' Depending on your SMTP server, you may not need
    ' the SMTP login or SMTP password.
    mailman.SmtpHost = "smtp.earthlink.net"
    mailman.SmtpUsername = "MYUSERNAME"
    mailman.SmtpPassword = "MYPASSWORD"
    
    ' Create an email for sending
    Dim email As New ChilkatEmail2
    ' Set the email subject and body
    email.Subject = "test"
    email.Body = "this is a test" & vbCrLf & "line 2" & vbCrLf & "-Bill"
    email.AddTo "John Doe", "john@chilkatsoft.com"
    email.FromAddress = "bill@chilkatsoft.com"
    email.FromName = "Bill Doe"
    
    ' Add a file attachment to the mail.
    email.AddFileAttachment "dude.gif"
        
    ' Send mail.  Returns 1 if successful, 0 if failed.
    success = mailman.SendEmail(email)
    If (success = 0) Then
        MsgBox mailman.LastErrorText
    End If
    

End Sub

 

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

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