email from vb6 app won't send till outlook is run
Posted on 2005-05-04
I am using this code to email a registration request from an app i am writing to my emmail address.
Problem is it queues the emails till I open Outlook, which is not my default email client.
The emails are then sent. I am using this system of sending the requests because I understood it would allow the user to send without an Outlook window being opened, and hence be more convenient
Why is it queueing the out traffic and not sending it immediately, please?
Here is the function doing the sending:
(MYADDRESS is a string constant containing a valid email address)
' send emails, using : outlook 10.0 object library
Public Function SendMyMessageNow(ByVal sThisInfo As String, _
ByVal sTextOfMessage As String) As Boolean
Dim objOL As Outlook.Application
Dim MyMail As MailItem
On Error GoTo ErrHandler
Set objOL = CreateObject("Outlook.Application")
Set MyMail = objOL.CreateItem(olMailItem)
.To = MYADDRES
.Subject = "Registration request: "
.Body = sThisInfo & " > " & sTextOfMessage
Set MyMail = Nothing
Set objOL = Nothing
SendMyMessageNow = True
MsgBox (Err.Number & vbCrLf & _
Err.Description & vbCrLf & _
" Error in SendMyMessageNow ")
SendMyMessageNow = False