I have an email requirement , using an invoke vb code inside UiPath causes a security feature to pop up in outlook. I looked into some causes and its due to outlook having an object model guard that creates this pop up when a third party tries to send an email hence why this pop up is occurring also using the mail activities in studio is also causing this issue to happen I came up with a vbscript that uses a Wscriptshell object. When I send it using this method it sends without the security pop-up but I’m using a scripting environment for vbs.
This is the code I’m using in vbs that works for me but when I’m executing the script using the invoke VBS activity in studio there are a few issues I see. One of the arguments specifically .subject or .body is not sending correctly when I try to use an input argument only hard coded string values are working (hence why i have hard coded examples in the post). Is there a way to translate this to vb.net using the powershell object or is there a way I can make the vbs better. Anytime I try to access the properties inside the mail item inside the ise when I’m using it doesn’t show any of the .to .subject .body methods but it works when i run the code so for me its tricky to debug.
'Dim strBody, strSubject, strTo
'strTo = WScript.Arguments(0)
'strSubject = WScript.Arguments(1)
'srBody = WScript.Arguments(2)
Set shell = CreateObject(“Wscript.Shell”)
Set outL = CreateObject(“Outlook.Application”)
Set mi = outL.CreateItem(0)
mi.display
mi.To = “jazlyn.luben@***.com”
mi.Subject = “test sub”
mi.HTMLBody = "test body "
shell.Sendkeys “%s”
WScript.Echo(“email sent.”)