View Single Post
  #1  
Old June 3rd 09, 01:08 PM posted to microsoft.public.dotnet.languages.vb,microsoft.public.outlook,microsoft.public.outlook.general,microsoft.public.outlook.program_vba
Diane Poremsky [MVP]
external usenet poster
 
Posts: 12,991
Default Emails getting stuck in Outbox

You should be posting this to the outlook.program_vba group - the outlook
developers don't usually visit the general groups.

--
Diane Poremsky [MVP - Outlook]
Outlook Tips: http://www.outlook-tips.net/
Outlook & Exchange Solutions Center: http://www.slipstick.com

Outlook Tips by email:


EMO - a weekly newsletter about Outlook and Exchange:


You can access this newsgroup by visiting
http://www.microsoft.com/office/comm...s/default.mspx or point your
newsreader to msnews.microsoft.com.


"John" wrote in message
...
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



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



Ads