Get unique ID mail message

Hello,

I am building an automation that deals with emails being dispatched to a queue to be processed later by another robot.

The emails are Google gmail messages and to the queue I want to upload the unique IDs for these emails because I want the robot to grab these emails at a later time, save the attachments and move the emails to another label.

I tried uploding the queue items with mailMessage.MessageId but when I tried retrieving the gmail emails by these message ids I got 0 results.

I also tried with mailMessage.Headers(“Message-ID”), mailMessage.Headers(“ID”), mailMessage.Headers(“UID”) and mailMessage.Headers(“Uid”) but these didn’t work, as they returned the email id as null.

Does anybody know how to get the unique id of a gmail message?

Thank you.

instead of looking for a unique id… you can try to use the mailMessage.Headers(“Date”).ToString…
and this will be unique for sure(convert to CDate and get the complete date )

1 Like

Can’t 2 emails have the same date and time? What about batch emails?

if you extract complete dateformat till the milliseconds - number will be unique for sure(even for the bulk mails)

you can refer below link for datetime conversation till milliseconds
https://docs.microsoft.com/en-us/dotnet/standard/base-types/how-to-display-milliseconds-in-date-and-time-values

1 Like

Okay, thank you. I will try this.

let us know if it worked as expected.

Hi, I got busy with work and I forgot to update this post. But yes, using your solution worked.

1 Like

This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.