VB.NET Examples

ChilkatHOMEASPVisual BasicVB.NETC#Visual C++CMFCDelphiFoxProJavaPerlPHPPythonRubySQL ServerVBScript

VB.NET Examples

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

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

Byte Array
VB.NET FTPS
System.IO

 

 

 

 

 

 

Add File Attachments to an Email

Demonstrates how to add one or more file attachments to an email.

Download Chilkat .NET for 2.0 / 3.5 Framework

Download Chilkat .NET for 64-bit 2.0 / 3.5 Framework (x64)

Download Chilkat .NET for 1.0 / 1.1 Framework

Dim email As New Chilkat.Email()

email.Subject = "This is a test"
email.Body = "This is a test"
email.From = "support@chilkatsoft.com"
email.AddTo("Chilkat Admin","admin@chilkatsoft.com")

Dim success As Boolean

'  To add file attachments to an email, call AddFileAttachment
'  once for each file to be attached.  The method returns
'  the content-type of the attachment if successful, otherwise
'  returns cknull
Dim contentType As String

contentType = email.AddFileAttachment("something.pdf")
If (contentType = vbNullString ) Then
    TextBox1.Text = TextBox1.Text & email.LastErrorText & vbCrLf
    Exit Sub
End If


contentType = email.AddFileAttachment("something.xml")
If (contentType = vbNullString ) Then
    TextBox1.Text = TextBox1.Text & email.LastErrorText & vbCrLf
    Exit Sub
End If


contentType = email.AddFileAttachment("something.zip")
If (contentType = vbNullString ) Then
    TextBox1.Text = TextBox1.Text & email.LastErrorText & vbCrLf
    Exit Sub
End If

success = email.SaveEml("email.eml")
If (success = false) Then
    TextBox1.Text = TextBox1.Text & email.LastErrorText & vbCrLf
    Exit Sub
End If


MsgBox("Saved EML!")
 

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

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

Mail Component · XML Parser