09-17-2003, 02:48 PM
Join Date: Dec 2002
Email takes too long to send
I'm using the following code to send an Email
Public Function SendEmail(eTo As String, eSubject As String, eBody As String)
Dim objOutlook As Object
Dim objOutlookMsg As Object
Set objOutlook = CreateObject("Outlook.Application")
Set objOutlookMsg = objOutlook.CreateItem(0)
.To = eTo
.Subject = eSubject
.Body = "This is the body of message"
.HTMLBody = eBody
Set objOutlookMsg = Nothing
Set objOutlook = Nothing
MsgBox "Email message sent to: " & eTo, vbExclamation, "Email Sent"
The problem is, when Outlook is up and running, it takes no time at all to send the message. When Outlook is shut down it takes about 45 seconds to send the message. How could I speed this up?
Thank you for any replies.