Microsoft Office Forums

Go Back   Microsoft Office Forums > >

Reply
 
Thread Tools Display Modes
  #1  
Old 08-20-2015, 05:49 AM
microbyte microbyte is offline Emails sent from Access using Outlook are sent but left in outbox Windows 7 64bit Emails sent from Access using Outlook are sent but left in outbox Office 2013
Novice
Emails sent from Access using Outlook are sent but left in outbox
 
Join Date: Aug 2015
Posts: 1
microbyte is on a distinguished road
Default Emails sent from Access using Outlook are sent but left in outbox

Hi,

Hoping someone can help.

Environment:
Exchange 2010
Office 2013
Outlook profile with 2 exchange accounts (one for the user, one is a generic account used by multiple users, this is set as the default account)

Scenario:
We have an access database that sends emails using outlook and send out using the default mailbox.
The emails send fine but the message is left in the Outbox.

If you sent an email from Outlook using the default account it works fine.



Has anyone experienced this before?
Any ideas on what to check/try?

Thanks
Will
Reply With Quote
  #2  
Old 08-20-2015, 10:18 PM
gmayor's Avatar
gmayor gmayor is offline Emails sent from Access using Outlook are sent but left in outbox Windows 7 64bit Emails sent from Access using Outlook are sent but left in outbox Office 2010 32bit
Expert
 
Join Date: Aug 2014
Posts: 4,106
gmayor has much to be proud ofgmayor has much to be proud ofgmayor has much to be proud ofgmayor has much to be proud ofgmayor has much to be proud ofgmayor has much to be proud ofgmayor has much to be proud ofgmayor has much to be proud of
Default

I found when developing http://www.gmayor.com/ManyToOne.htm that sending messages could be fraught with problems depending on the type and settings of the e-mail account so I produced a catch-all macro which will force the sending of any messages in the outbox. It basically opens each message in the Outbox and issues a send command then performs Send and Receive All.

Code:
Sub SendMessages()
Dim olApp As Object
Dim olItems As Object
Dim olItem As Object
Dim olNS As Object
Dim olSycs As Object
Dim olSyc As Object
Dim bStarted As Boolean
Dim i As Long

    On Error Resume Next

    Set olApp = GetObject(, "Outlook.Application")
    If Err <> 0 Then
        Set olApp = CreateObject("Outlook.Application")
        bStarted = True
    End If

    Set olNS = olApp.GetNamespace("MAPI")
    olNS.logon
    Set olSycs = olNS.SyncObjects
    Set olItems = olNS.GetDefaultFolder(4).Items
    For i = olItems.Count To 1 Step -1
        Set olItem = olItems(i)
        olItem.sEnd
    Next i

    For i = 1 To olSycs.Count
        Set olSyc = olSycs.Item(i)
        olSyc.Start
    Next i
CleanUp:
    If bStarted = True Then
        olApp.Quit
    End If
    Set olApp = Nothing
    Set olItems = Nothing
    Set olItem = Nothing
    Set olNS = Nothing
    Set olSycs = Nothing
    Set olSyc = Nothing
lbl_Exit:
    Exit Sub
End Sub
The code as written is intended to be used from an Office application other than Outlook. It will need a few small changes (see below) if you want to run it from Outlook VBA

Code:
    'Set olApp = GetObject(, "Outlook.Application")
    Set olApp = Outlook.Application
    'If Err <> 0 Then
    '    Set olApp = CreateObject("Outlook.Application")
    '    bStarted = True
    'End If

    Set olNS = olApp.GetNamespace("MAPI")
    'olNS.logon
__________________
Graham Mayor - MS MVP (Word) (2002-2019)
Visit my web site for more programming tips and ready made processes www.gmayor.com
Reply With Quote
Reply



Similar Threads
Thread Thread Starter Forum Replies Last Post
Emails sent from Access using Outlook are sent but left in outbox Processing Outlook emails items from Access Glenn_Suggs Outlook 2 11-20-2014 08:35 AM
Emails sent from Access using Outlook are sent but left in outbox take emails from outlook mailbox and folders to Access megatronixs Outlook 6 10-23-2014 06:42 AM
Access emails for different logins harshada Outlook 0 12-11-2013 09:45 PM
Export Outlook emails to Access & parse certain text elements smahale Outlook 0 01-18-2012 09:30 PM
Emails sent from Access using Outlook are sent but left in outbox 2007 Outlook Outbox issues MrPerkins Outlook 1 04-25-2009 03:14 PM

Other Forums: Access Forums

All times are GMT -7. The time now is 11:01 AM.


Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2024, vBulletin Solutions Inc.
Search Engine Optimisation provided by DragonByte SEO (Lite) - vBulletin Mods & Addons Copyright © 2024 DragonByte Technologies Ltd.
MSOfficeForums.com is not affiliated with Microsoft