Sending mail through invoke powershell activity

Hi,

I have created powershell script for sending email and emails are getting sent while executing it through powershellISE editor. However on running same through invoke powershell activity, I am getting an error. In later case, error is received only if outlook is not launched and execution is successfully if outlook is launched. While executing through PowershellISE editor, it is getting executed successfully irrespective of outlook is launched or not. Could you please advise if we can execute the script successfully with outlook closed. I have attached the project folder.

Thanks,

htmlTest.zip (3.3 KB)