I have to send emails via Powershell (the Send Mail activity isn’t an option, as I’m using an old version of UiPath Studio which doesn’t support the activity), and I’ve never used Powershell before. I have the code and can invoke it, but there’s one thing I can’t work out.
The process is: download a load of PDFs, read through them one by one to find an account number. If the account number is between 1-5, it’ll send the PDF in an email to account holder from the email address 1@email.com. If the account number is between 6-10, it’ll send the email from 2@email.com, and so on.
The thing I can’t work out is how to change the subject of the email (which will be the account number, so this will be different for every email), how to change the recipients email address, and how to change the body of the email, as these are all hard written into the .txt Powershell code.
If you want to dynamically pass a variable you can create powershell variables in the powershell variable field. Then you can add those same variables in the text file as well.
For example if the powershell variable declared is emailId, use that in the text file as $emailId.
Thanks, if that’s a requirement not to use it for any kind of concern, then it is what it is, but sometimes restrictions are dumb and we may only be afraid to ask why?
FYI, You can still explore using UiPath.Mail.Activities 1.4.0 should be more than safe for your studio version, I believe what you’re looking is to send email through SMTP. Hope you can solve it.
As far as my memory recalls (working with UiPath since 2017) Mail.Activities package was always part of the standard installation and it always contained “Send SMTP Mail Message” activity.
Also the package version is process dependent so you are quite free to choose Mail.Activities package version.
Using powershell for this purpose seems quite obscure
I agree, using Powershell does seem obscure and it isn’t my first choice to use it. However, whenever I try to use the Send Mail activity I get this error:
One of the support team in work looked into it and advised that it was due to UiPath needing to be upgraded to version 2019.4.6+. I also have been working with UiPath since 2017 and have always used this activity without any issues, but figured they might be trying to get people to upgrade versions and maybe phasing things out?
Did you try update the Mail.Activities package to some later version?
According release notes in v1.6.0 there was some TLS related fix.
I would recommend upgrade Mail.Activities package step-by-step until works.
Cheers
The update button is greyed out, do you know how I’d get around this? I’ve uninstalled and reinstalled it but got the same version, and 1.4.1 is the only version available on the drop down menu