Chilkat HOME ASP Visual Basic VB.NET C# Visual C++ C MFC Delphi FoxPro Java Perl PHP Python Ruby SQL Server VBScript
Add File Attachments to an EmailDemonstrates how to add one or more file attachments to an email.
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.