Emails getting stuck in Outbox

J

John

Hi

I am sending a number of emails (around 600) using the vb.net code below.
The problem is that the emails end up in the OL2007 Outbox with a clock icon
and do not go out. If I open one of the email items and click Send then that
item goes out but this technique is too cumbersome for 600 or so emails.
What is the problem and how can I fix it?

Many Thanks

Regards
 
K

Ken Slovak - [MVP - Outlook]

What code below?

If you are setting a delayed sending time on the items that would account
for what you see.
 
J

John

Hi Ken

Sorry. Code is now below. I am not setting any delay as far as I can see,
unless something gets set by default in OL2007.

Many Thanks

Regards


Dim objOutlook As Object = CreateObject("Outlook.Application")
Dim NS As Object = objOutlook.GetNamespace("MAPI")
Dim objOutlookMsg As Object
Dim BodyText As String
Dim fso, ts

fso = CreateObject("Scripting.FileSystemObject")
ts = fso.OpenTextFile(Me.txtHtml.Text.ToString, 1)
BodyText = ts.ReadAll

NS.Logon()

While ....
' Create the message.
objOutlookMsg = objOutlook.CreateItem(0)
objOutlookMsg.To = "some address"
objOutlookMsg.Subject = "some subject"
objOutlookMsg.HTMLBody = BodyText

objOutlookMsg.send()

objOutlookMsg = Nothing
System.Windows.Forms.Application.DoEvents()
End While

NS.Logoff()
NS = Nothing

objOutlook = Nothing
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top