Pass mail message as output argument



Is it possible to pass a System.Net.Mail.MailMessage as an output variable from an invoked workflow? Suppose you have a process that reads email, and then based on what happens later in the process you will want to move the email to different folders.
When I try to pass the mail message as an output from the workflow where the email is read, my process stops (without even failing, I have to manually terminate it.) Any ideas on what I could be missing - or is it simply not allowed to pass mail messages as output?


Hi @tea,

it should work, can you check the argument are you passing correctly.



Hi, I will check again and do some more testing. Maybe I have been missing something… Thank you for your reply!


2 reasons:

You might have checked the isolated checkbox which will work only with serializable arguments, and mailmessage cannot be serialized (directly)


Hmm, where can I find this checkbox?




Hi, now I actually see that the activity used wasn’t invoke workflow, but launch workflow interactive. Maybe this could explain why? I can try to change it to an invoke instead.


Launch Workflow Interactive(lwi) and Isolated invoke workflow opens the wf as a saperate process and the arguments needs to be serialized.

What is your purpose of using lwi? I may not be right but i don’t see a point using lwi for invoking child workflows, you could use isolated.You could use it to initiate your robot OR use orchestrator runtime settings/change uipath settings file
to manage the resolution.

You could use non isolated workflow as long as you don’t have heavy duty activities which could lead to robot crash because of Out of memory exception.

Or you could pass individual email properties like subject address body as individual arguments, if you are not using the mailmessage as a whole,like for email forwarding it in your downstream process.




It is actually not me who developed the process, I am just trying to make some adjustments, so I don’t know why launch workflow was chosen and not invoke. So I think I can just try to change to invoke and see if this fixes it.

When it comes to passing individual email properties instead I don’t think that will do it for me, since my reason for taking the email as an output is that I want to move the mail itself to a different email folder later in the process.

Thank you for your help, I will let you know if switch to invoke does the trick!