Outlook2007 Email problem with automation

  • Thread starter Thread starter Dennis Rose
  • Start date Start date
D

Dennis Rose

I am using automation in a VB5 program to send Emails using Outlook2007. If
I use the ".Send" mailitem the email is sent out Immediately.

If I use the ".Display" mailitem in my program, after I look over the Email
and then click the "Send" button on the Outlook display screen, the email is
placed in my outbox but does not get sent out. I have to exit my program and
then click "Outlook". When Outlook displays, I can see the Email in the
Outbox which will then automatically go out (without me having to click send
and receive).

I want the Email to immediately go out (when using the ".Display" mailitem
in my program) after clicking the "Send" button on the Outlook display
screen.

What do I need to do??
 
Do you immediately set the variable poiting to the message to Nothing?
What is the relevant snippet of your code?
Are you sending through SMTP or Exchange?

--
Dmitry Streblechenko (MVP)
http://www.dimastr.com/
OutlookSpy - Outlook, CDO
and MAPI Developer Tool
-
 
Thanks for the reply!

I am sending thru SMTP.

This is my code:

Private Sub SendEmail()
Dim OutApp as Outlook.Application
Dim OutMail as Outlook.MailItem

If OutlookPresent = True Then
Set OutApp = CreateObject("Outlook.Application")
OutApp.Session.Logon
Set OutMail = OutApp.CreateItem(olMailItem)

With OutMail
.To = txtEMailAdr.Text
.CC = ""
.BCC = ""
.Subject = "Customer Follow-Up"
.SendUsingAccount = OutApp.Session.Accounts.Item(1)
.Display
End With
On Error GoTo 0

Set OutMail = Nothing
Set OutApp = Nothing

MsgBox "Email Sent"
End If
End Sub
'********************************
 
Back
Top