Error using Get Outlook Mail Message from Outbox

I want to check if there are any emails in my outbox before starting my activity. I am using Get Outlook Mail Messages with MailFolder = “Outbox”.

If there are messages in the outbox, UiPath throws an error “Get Outlook Mail Messages: Outlook has already begun transmitting this message.” and ends the whole process.

I just want to get a count of how many emails are in the outbox so I can add a delay before continuing with my activity.

Is there any way to use the Get Outlook Mail Message activity on the outbox while the messages are being sent? Or is there any other way to get a simple count of how many emails are in the outbox?

Welcome to the UiPath Community @KevinE

That error seems that the outlook email currently being send can’t be accessed via outlook application api.

You van either use Exchange Activities or you can consider using a powershell script for the same. Below is one zip

Below link might help

Hi @KevinE

Check the count Using the Specified folder from the mail message activity!

MailVariable.count will the give the count of mails in the spefied folder.

Regards

I tried using Exchange Activity, but I don’t know my server address or password for the email account. It is a shared account that I have been delegated access.

I don’t know how to use powershell, I tried the link from the other post but I get another error message. I’m not really interested in learning powershell.

Is there maybe a way for UiPath to stop Outlook from sending emails while checking the outbox, then resume sending emails after the activity is finished?

That is how I would count the messages after the Get Outlook Mail Message activity completes.

My issue is that the Get Outlook Mail Message activity fails and throws an error. There is no MailVariable because the activity fails.

Hello @KevinE,

why do you want to see e-mails which are in the Outbox? You’d like to check if they’ve been sent or not?

Best,

Artur

Yes, I want to check if they have been sent or not.

My process creates emails faster than outlook can send them, so I want to check that the previous emails have finished sending before I create new emails.

The best way to solve it is to open Outlook app by using “Open App/Browser” activity (modern design) and then send e-mail in this activity. This will make sure that email has been sent properly.

One even better way is to use Office365 API. If you know something about Azure App Registrations and you have necessary privileges, I can guide you. :slight_smile:

Best regards

Artur

This is not the problem.

In case anyone else comes across the same issue, there does not seem to be any way to do this within UiPath / Outlook.

Using App Integration > Mail > Outlook > Get Outlook Mail Messages results in an error and causes the emails in the Outbox to stop sending
Using Integrations > Gmail and Outlook > Use Outlook 365 > For Each Email does not throw an error, but it causes the emails in the Outbox to stop sending

It would be great if UiPath had an option to pause Send / Receive while using Get Mail Messages, or a separate activity to cancel and resume Send / Receive, but I have not found any activity like this.

For now I have handled my issue by sending an email to myself before using Get Mail Messages. If there are any emails in the outbox, I will not receive my self email until all the others have been sent. I then add an Outlook Mail Message Trigger to wait for this email before continuing to Get Mail Messages.