Visual Basic Examples

ChilkatHOMEAndroid™ASPVisual BasicVB.NETC#iOS (IPhone)Objective-CC++CUnicode C++Unicode CMFCDelphi DLLDelphi ActiveXFoxProJavaPerlPHP 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

 

 

 

 

 

 

 

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. To add more than one attachment, call AddFileAttachment once for each file to be attached.

' 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.
    Dim contentType as String
    contentType = email.AddFileAttachment "dude.gif"
    If (contentType = vbNullString ) Then
        MsgBox email.LastErrorText
        Exit Sub
    End If    

    ' Send mail.  Returns 1 if successful, 0 if failed.
    success = mailman.SendEmail(email)
    If (success = 0) Then
        MsgBox mailman.LastErrorText
    End If
    

End Sub

 

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