Chilkat HOME ASP Visual Basic VB.NET C# Visual C++ C MFC Delphi FoxPro Java Perl PHP Python Ruby SQL Server VBScript
|
Send Mail with a GIF File Attachment
(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.