Unable to add variable of mailMessage type into Queue

I am unable to add variable of mailMessage type into Queue whereas i am able to add basic types like string and rows.

So I tried a workaround of converting the mailMessage into string by serializing using jsonConvert function and adding into queue. But when I deserialize and try to extract into mail format, it does’nt support. Has anyone faced this issue before or successfully added mails as queue items and processed pls share your solutions.

Thanks in advance!

1 Like


May I know the reason why you need to add the mail messages to Queue, instead of that you can save the mail messages in a folder and you can save each mail message path into the queue. This will help you to continue with processing queue items one by one. you have full track as well.

Thanks @sarathi125 for the workaround.

Since the MailMessage class isn’t natively serializable, you’d have to serialize it yourself. Another option is to extract the parts that you want from the MailMessage object (e.g., subject and body), then save those in the queue item.
Related: How to create Orchestrator Queues for emails in a mailbox? - #6 by Mateus_Cruz

1 Like

have tried this approach and it worked.

  1. Add message ID of the mail to transaction item of the queue in the dispatcher process.

Message ID = <Mail.Message .headers(“UID”).To string

  1. In performer process, extract the Message ID from the queue.

  2. Use Message ID in Get Mail by ID activity to get the Mail Message which you can use for further processing like Reply to Outlook Mail Activity.

Please mark it as solution if this helps. Cheers