Chilkat
HOME
Android™
ASP
Visual Basic
VB.NET
C#
iOS (IPhone)
Objective-C
C++
C
MFC
Delphi
FoxPro
Java
Perl
PHP Extension
PHP ActiveX
Python
PowerShell
Ruby
SQL Server
VBScript
Background Mail Sending using SMTP Queue
This example shows how to send asynchronous email in the background using the SMTP Queue service.
' Send mail in the background using the SMTP Queue service
Private Sub Command1_Click()
Dim mailman As ChilkatMailMan2
Set mailman = New ChilkatMailMan2
' Anything will begin the 30-day trial.
mailman.UnlockComponent "UnlockCode"
mailman.SmtpHost = "smtp.earthlink.net"
' Only set username/password if your SMTP server requires a logon.
'mailman.SmtpUsername = "your_username"
'mailman.SmtpPassword = "your_password"
' Only set the login domain if your SMTP server uses integrated Windows authorization
' AND it is part of a domain.
'mailman.SmtpLoginDomain = "your_domain"
' How do I send an email with an attachment?
Dim email As ChilkatEmail2
Set email = New ChilkatEmail2
email.AddTo "Chilkat Support", "support@chilkatsoft.com"
email.Subject = "Test of sending queued mail from VB using the SMTP queue"
email.Body = "This email was sent from Visual Basic using the SMTP queue service"
email.FromName = "Matt"
email.FromAddress = "matt@chilkatsoft.com"
'email.ReturnReceipt = 1
' Add a file attachment.
Dim contentType As String
contentType = email.AddFileAttachment("sample.jpg")
' To send encrypted and/or signed emails, just set these flags.
'email.SendEncrypted = 1
'email.SendSigned = 1
Dim success As Long
success = mailman.SendQ(email)
Label1.Caption = "Success: " & Str(success) & vbCrLf
If (success = 0) Then
' Failed.
MsgBox mailman.LastErrorText
End If
End Sub
|
© 2000-2012 Chilkat Software, Inc. All Rights Reserved.