![]() |
|
#1
|
|||
|
|||
|
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 |
|
#2
|
||||
|
||||
|
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
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 |
|
|
|
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
Processing Outlook emails items from Access
|
Glenn_Suggs | Outlook | 2 | 11-20-2014 08:35 AM |
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 |
2007 Outlook Outbox issues
|
MrPerkins | Outlook | 1 | 04-25-2009 03:14 PM |