How to pass SecureString variable as String format variable in SMTP Mail


I want to pass my yahoo password which is getting from orchestrator into a secure string variable yahoopwd. but unable to pass this variable into String type input for smtp mail.

please suggest secureway.

Below screenshot working correctly but unable to pass yahoopwd variable to smtp password field.

1 Like

You solution lies here:


Agree Nadim,

But is it secure?..because i can see my password…

The smtp takes a string variable itself.

So, you assign to a string variable using the logic in thread and then use that assign in the smtp password.
Your assign you can keep Private enabled.

1 Like


Do let me know if its what you need

implemented correctly as per your suggestion.

Thanks Nadim…

I would highly recommend not using an Assign activity to store the securestring to a string, because it will be stored in memory or outputted while in debug. You can however, check the “Private” box on the Assign to hide it. I would recommend converting the securestring to string directly in the Password field of the Send SMTP (assuming it even requires a password which in many cases it might not depending on your company’s SMTP setup)



I tried converting a secure string into a string using the .ToString method within the password field of the Send SMTP Activity. It doesn’t work.

I found another method suggested by a UiPath employee that is more secure than the method suggested by nadim.warsi.

Regardless of these tricks and workarounds, it is still a risk. The SMTP and IMAP activities must and should accept a secure string variable as the input. That alone will give more credibility to our bots.

Here is a detailed article on that :slight_smile: