Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. Visual Basic
  4. Messages stuck in Outlook 2003 outbox

Messages stuck in Outlook 2003 outbox

Scheduled Pinned Locked Moved Visual Basic
helpcomjsonquestion
3 Posts 2 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • D Offline
    D Offline
    dBrong
    wrote on last edited by
    #1

    I am sending emails through Outlook 2003. The problem I'm having is that the message goes into the outbox, but if the user's outlook isn't open, the message just stays in the outbox. Can I some how siently start outlook, and 'send/receive' all? Dim OutlookApplication As New Microsoft.Office.Interop.Outlook.Application Dim OutLookMailItem As Microsoft.Office.Interop.Outlook.MailItem Dim imailitem As Int32 = Microsoft.Office.Interop.Outlook.OlItemType.olMailItem OutLookMailItem = CType(OutlookApplication.CreateItem(imailitem), Microsoft.Office.Interop.Outlook.MailItem) 'Set To and Subject of the email. OutLookMailItem.Subject = cSubject OutLookMailItem.Attachments.Add(Me.emailDirPath + fname + cExtension) 'Display MailItem and let them fill in the rest! ' ' make it modal ' Me.Cursor = Cursors.Default OutLookMailItem.Display(True)

    P 1 Reply Last reply
    0
    • D dBrong

      I am sending emails through Outlook 2003. The problem I'm having is that the message goes into the outbox, but if the user's outlook isn't open, the message just stays in the outbox. Can I some how siently start outlook, and 'send/receive' all? Dim OutlookApplication As New Microsoft.Office.Interop.Outlook.Application Dim OutLookMailItem As Microsoft.Office.Interop.Outlook.MailItem Dim imailitem As Int32 = Microsoft.Office.Interop.Outlook.OlItemType.olMailItem OutLookMailItem = CType(OutlookApplication.CreateItem(imailitem), Microsoft.Office.Interop.Outlook.MailItem) 'Set To and Subject of the email. OutLookMailItem.Subject = cSubject OutLookMailItem.Attachments.Add(Me.emailDirPath + fname + cExtension) 'Display MailItem and let them fill in the rest! ' ' make it modal ' Me.Cursor = Cursors.Default OutLookMailItem.Display(True)

      P Offline
      P Offline
      Paul Conrad
      wrote on last edited by
      #2

      Have you figured this out, or are you still having trouble with it?

      "Real programmers just throw a bunch of 1s and 0s at the computer to see what sticks" - Pete O'Hanlon

      D 1 Reply Last reply
      0
      • P Paul Conrad

        Have you figured this out, or are you still having trouble with it?

        "Real programmers just throw a bunch of 1s and 0s at the computer to see what sticks" - Pete O'Hanlon

        D Offline
        D Offline
        dBrong
        wrote on last edited by
        #3

        I found the answer: Dim oApp As Microsoft.Office.Interop.Outlook._Application = New Microsoft.Office.Interop.Outlook.Application Dim oNS As Microsoft.Office.Interop.Outlook._NameSpace = oApp.GetNamespace("mapi") Dim oSyncs As Microsoft.Office.Interop.Outlook.SyncObjects Dim oSync As Microsoft.Office.Interop.Outlook.SyncObject Try ' Reference SyncObjects. oSyncs = oNS.SyncObjects oSync = oSyncs.Item("All Accounts") ' Send and receive. oSync.Start() Catch ex As Exception MessageBox.Show("oSync Error: " + ex.Message, "Error Sending Email From Outlook") End Try ' Clean up. oSync = Nothing oSyncs = Nothing oNS = Nothing oApp = Nothing

        1 Reply Last reply
        0
        Reply
        • Reply as topic
        Log in to reply
        • Oldest to Newest
        • Newest to Oldest
        • Most Votes


        • Login

        • Don't have an account? Register

        • Login or register to search.
        • First post
          Last post
        0
        • Categories
        • Recent
        • Tags
        • Popular
        • World
        • Users
        • Groups