New Outlook (1 Viewer)

gemma-the-husky

Super Moderator
Staff member
Local time
Today, 14:53
Joined
Sep 12, 2006
Messages
15,962
Can anyone confirm and circumstances in which access can no longer send emails via outlook.

Would upgrading to Windows 11 cause an issue?
Would clicking "activate new outlook" cause an issue?

I just want to try and identify any likely causes of access no longer sending emails correctly.
 
Activating new outlook would do it I believe.
I just took that off that task bar of my sister's new laptop.
Not win11 as I can happily send emails from access in 2019.
 
I believe the issue is if you're using New Outlook, then you wouldn't be able to automate it anymore. For example, this won't work.
Code:
Set olApp = CreateObject("Outlook.Application")
 
Last edited:
New Outlook does not conform to the Component Object Model methods of doing things.

Every now and then I get the invitation to try "New" Outlook. I turn it down every time. Since I'm not on O365 but rather have an LTSC version of O2019, I can still do that.
 
A registry fix was posted in another thread here to stop it being used. Have a search.
 
I believe the issue is if you're using New Outlook, then you wouldn't be able to automate it anymore. For example, this won't work.
Code:
Set olApp = CreateObject("Outlook.Application")
Sad 😢
 
Last edited by a moderator:
This is from another site (not Access related forum). I don't have new outlook and I can not test it. But several people I know have used it without problem (or at least they say so)

There are 3 ways to send a mail from VBA with New Outlook.

Method 1 : Mailto
Code:
Dim strMail As String
strMail = "mailto:recipient@example.com?subject=Test Subject&body=Hello from VBA!"
FollowHyperlink strMail
Pros:
Simple, no need for special permissions.

Cons:
User must manually press "Send."
Limited customization.

Method 2: Power Automate:
Microsoft encourages using Power Automate (formerly Flow) to send emails in New Outlook. Here's how:
  1. Go to Power Automate and create a new flow.
  2. Use the "When an HTTP request is received" trigger.
  3. Add the "Send an email (V2)" action (Outlook 365 connector).
  4. Get the Flow's URL and store it in your app.
  5. From your app, use VBA to send data to the Flow:
Code:
Dim http As Object
Dim JSON As String
Set http = CreateObject("MSXML2.XMLHTTP")

JSON = "{""To"":""recipient@example.com"",""Subject"":""Test Email"",""Body"":""Hello from vba via Power Automate""}"

http.Open "POST", "https://prod-XX.westus.logic.azure.com/workflows/YOUR_FLOW_URL", False
http.setRequestHeader "Content-Type", "application/json"
http.Send JSON
Pros:
Fully automated.
No security warnings.

Cons:
Requires Power Automate & API permissions.
Needs a Microsoft 365 subscription


Method 3 : Using Microsoft Graph API
Since New Outlook is based on Microsoft 365 & Exchange Online, you can send emails using Microsoft Graph API.
  1. Register an app in Azure Active Directory.
  2. Grant Mail.Send permissions.
  3. Use VBA with MSXML2.ServerXMLHTTP to send emails via Graph API.
JSON:
POST https://graph.microsoft.com/v1.0/me/sendMail
Authorization: Bearer YOUR_ACCESS_TOKEN
Content-Type: application/json

{
  "message": {
    "subject": "Test Email",
    "body": {
      "contentType": "Text",
      "content": "Hello from vba via Graph API!"
    },
    "toRecipients": [
      {
        "emailAddress": {
          "address": "recipient@example.com"
        }
      }
    ]
  }
}
Pros:
Fully automated.
Supports attachments & formatting.
No manual interaction needed.

Cons:
Requires Azure AD setup.
Needs OAuth token handling.
 
Last edited:
You forgot CDO, which isn't specific to Access, but can be done using VBA.

Nice take on the JSON/html stuff - is that a real thing? i've never used that before to send an email. Almost looks too good to be true
 
is that a real thing?
Unfortunately I’m not sure about it. We don’t use Azure and haven’t New Outlook. So no way to test it.
It was from a private site we use and some confirmed it’s OK. But I’m not sure which of above 3 methods they were talking about.
 
Edit, I see now that JSOn recommendation was for Power Automate.

Power Automate is great - and would be even a lot better IF Access played well with Sharepoint, thus triggering P.A. flows from a Sharepoint table update.
 
(Just being picky)
Method 2 is not Power Automate. It's a straightforward web request.


Oops, apologies, I didn't see the url
 
The issue for me is not sending emails - it's receiving and extracting data from them. I don't have access to new outlook but have experimented a bit with gmail in terms of downloading with occasional success to get a feel for what might be required. With gmail, it appears the structure of an email can vary in regards to attachments (seems to depend on what type of attachment).

However the overriding issue is even if I had 100% success with gmail, I doubt I can persuade my clients to change from outlook.

I've seen numerous examples for sending email but none for extracting. I've asked copilot but it suggests code that looks the same as for classic outlook - any suggestions for where to look for extracting emails/attachments from new outlook? mIght need a special search term but every thing I've tried results in examples for excel to extract from classic outlook

Edit: Just asked chatGPT - took 29 seconds to respond (reasoning) and initially came up with around 40 paragraphs all saying much the same thing (bug?) then condensed it to this reply:

The short answer is that the new Outlook (the modern, Chromium‐based client) does not support VBA macros. Unlike classic Outlook, where you could write VBA code to extract emails and attachments, the new Outlook doesn’t provide access to a VBA editor or the Outlook Object Model via VBA.

What This Means for You​

  • No VBA Support: If you’re using the new Outlook, any VBA code you’ve used in the classic version will not run.
  • Alternative Approaches:
    • Switch Back to Classic Outlook: If VBA is essential for your workflow, you may need to revert to the classic Outlook client until Microsoft (or third parties) provide a VBA solution for the new version.
    • Office Add-ins/JavaScript: Consider developing an Office add-in using Office.js. This modern add-in model works with both the new and classic Outlook clients.
    • Microsoft Graph API: For more robust and cross-platform solutions, you can use Microsoft Graph to interact with mailboxes, extract emails, and download attachments.

so perhaps javascript is a way forward - encouraging that it supposedly works with both options, tho' I'm guessing it won't be the same code
 
Last edited:
I went through the code carefully this morning checking everything, and found that some users didn't have the right settings to make the access/outlook integration worked. I tried fixing that, and everything seems to be working again.
 
Thanks @GPGeorge

I actually use Everything Access VBMapi rather than use outlook directly. I'm unsure whether that will still work with New Outlook.

I have also used CDO, but the problem there was that it doesn't put the outgoing message into your outbox,. All you seem to be able to do is send a copy to a different account, and effectively use that inbox as the outbox. Maybe I'm not using it correctly.
 
CDO ... doesn't put the outgoing message into your outbox

No, it doesn't. The "Outbox" is an artifact of the mail client, not of SMTP. Most mail clients "serialize" their mail, i.e. send it one message at a time in the order it was originally queued, holding pending messages in the Outbox. This behavior is a leftover from times when folks didn't have continuous network connections. They could compose and queue mail messages via their client, but it would hold everything in the Outbox until you established your network connection. And back in the "good old days" that network connection might have been over your telephone using dial-up modems, which is why you didn't leave the network connection open at all times. Your phone bill would have been astronomical.

CDO, being a more direct method, could in theory send many messages at once via SMTP methods. I say "in theory" because Access is still single-threaded. SMTP protocol allows near-simultaneous creation of multiple network sockets to facilitate mail transmission. If you had multiple apps running as distinct processes, they could run in parallel (particularly on a multi-processor CPU). Each process could send CDO mail directly, whereas using a mail client, they would drop into the Outbox and become serialized / linearized.
 
With CDO, I provide an option for the user to send a copy of the email to themself which overcomes that drawback
 

Users who are viewing this thread

Back
Top Bottom