• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 355
  • Last Modified:

E-mails sent from MS Acess Application get stuck in Sent folder

We have a function in MS Access that sends e-mails using Outlook.  This was working fine, then our company upgraded to an Outlook 2010 Exchange server.  Now this doesn't work anymore.   The e-mails are in the Sent folder, but never reach the recipients.  However, if you open the messages in the Sent folder and reply to all, they do get to the recipients.

Here is the source...

'SendMAPIEmailto replace the older one
 Public Function SendMAPIEmail(strTo As String, _
           strSubject As String, _
           strMessageBody As String, _
           Optional strAttachmentPaths As String, _
           Optional strCC As String, _
           Optional strBCC As String, _
           Optional strReplyTo As String, _
           Optional dtDTWhen As Date) As Boolean
   Dim mailItem As Outlook.mailItem
   Dim bSuccess As Boolean

   ' assume success but set error trap
   bSuccess = True
   lastOutlookErrorDesc = ""

 On Error GoTo SendMAPIEmail_Error

  ' if calling in a loop perhaps remove then clean, at end of loop
   If Not olApp Is Nothing Then
    Set mailItem = olApp.CreateItem(olMailItem)

    mailItem.To = strTo
    mailItem.Subject = strSubject

    ' mailItem.Display
    ' If we need HTML - we can use this:
    ' mailItem.HTMLBody = strMessageBody
    mailItem.Body = strMessageBody
    '------------ add all the optional items
    ' attachments
    If Not IsMissing(strAttachmentPaths) Then
     If (strAttachmentPaths <> "") Then
      Dim myAttachements As Outlook.Attachments
      Set myAttachements = mailItem.Attachments
      ' may need a little more work here
      myAttachements.Add strAttachmentPaths
     End If
    End If
    ' CC string
    If Not IsMissing(strCC) Then
     If strCC <> "" Then
      mailItem.CC = strCC
     End If
    End If
    ' BCC string
    If Not IsMissing(strBCC) Then
     mailItem.BCC = strBCC
    End If
    ' ReplyTo string
    If Not IsMissing(strReplyTo) Then
      If strReplyTo <> "" Then
        mailItem.ReplyRecipients.Add strReplyTo
      End If
    End If
    ' dtDTWhen string
    If Not IsMissing(dtDTWhen) Then
     mailItem.DeferredDeliveryTime = dtDTWhen
    End If
 '   When debugging this is useful
 '   mailItem.Display


'    GoTo EndSend
   End If

 ' clean up and exit
   SendMAPIEmail = bSuccess
   On Error GoTo 0
   Exit Function

 ' if we get here then something wne wrong
   bSuccess = False
   lastOutlookErrorDesc = Err.DESCRIPTION
   Resume SendMAPIEmail_Exit

 End Function
  • 2
  • 2
1 Solution
Jim Dettman (Microsoft MVP/ EE MVE)PresidentCommented:
Sounds like the problem is in Exchange.  I would look at the message tracking to see what the issue is.

If it's in the "sent" folder, Outlook considers it sent.

Jeffrey CoachmanMIS LiasonCommented:
Try commenting out the all the code regarding "dtDTWhen"
Not sure why it is needed, but it seems to have something to do with "sending" the email, ...this would be a good place to start your investigation.
Jim Dettman (Microsoft MVP/ EE MVE)PresidentCommented:
I missed that; good catch!

jribbleAuthor Commented:
Removing the dtDTWhen related statments solved the problem.  E-mails are now coming through to my Inbox.
Jeffrey CoachmanMIS LiasonCommented:

Again, that was just a shot in the dark...

As I stated, I was not sure what that was, or why it was needed...

Furthermore, I am not sure why it may have worked before, but does not work now...
(I'm no Exchange Expert...)


Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

Featured Post

Get 10% Off Your First Squarespace Website

Ready to showcase your work, publish content or promote your business online? With Squarespace’s award-winning templates and 24/7 customer service, getting started is simple. Head to Squarespace.com and use offer code ‘EXPERTS’ to get 10% off your first purchase.

  • 2
  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now