Outlook Security prompt

Technical support and scripting issues

Moderators: Dorian (MJT support), JRL

Post Reply
ckhokie
Newbie
Posts: 6
Joined: Fri May 23, 2008 4:28 pm
Location: USA

Outlook Security prompt

Post by ckhokie » Mon Jun 09, 2008 2:16 pm

How do I get around outlook security prompt. This is the function I am calling to send an email. I would like it to be silent or macro around it.

VBStart
Function CreateEmail(strRecipient, strSubject, strBody, strAttachment )
'Create OL App object
Set objOLApp = CreateObject("Outlook.Application")
OlSecurityManager.DisableOOMWarnings = True
If objOLApp is nothing then
MsgBox "Could not create OL App. Shutting Down"
Exit Function
End If

'Create a new mail item
Set objMsg = objOLApp.CreateItem(0)
If objMsg is nothing then
MsgBox "Could not create Mail Item. Shutting Down"
Exit Function
End If

'Set basic message parameters
objMsg.To = strRecipient
objMsg.Subject = strSubject
objMsg.Body = strBody
objMsg.Attachments.Add strAttachment,,,"Attachment1"

'Send the message
objMsg.Send

'Free up the space
Set objOLApp = Nothing
Set objMsg = Nothing

CreateEmail = "Success"
End Function
VBEnd
Let>strBody=Here is the error text file for testing. Number of errors are %ErrorAlert%.
VBEval>CreateEmail("%strTo%","%strSubj%","%strBody%","%strAttachment%"),Answer

User avatar
Marcus Tettmar
Site Admin
Posts: 7391
Joined: Thu Sep 19, 2002 3:00 pm
Location: Dorset, UK
Contact:

Post by Marcus Tettmar » Wed Jun 18, 2008 1:14 pm

Not sure that there's anyway to avoid it. Blame Microsoft. But do you really need to automate Outlook? Instead use an SMTP server and use the SMTPSendMail command to send the email directly.
Marcus Tettmar
http://mjtnet.com/blog/ | http://twitter.com/marcustettmar

Did you know we are now offering affordable monthly subscriptions for Macro Scheduler Standard?

ckhokie
Newbie
Posts: 6
Joined: Fri May 23, 2008 4:28 pm
Location: USA

Post by ckhokie » Wed Jun 18, 2008 1:28 pm

Thanks I will give that a try.

ckhokie
Newbie
Posts: 6
Joined: Fri May 23, 2008 4:28 pm
Location: USA

Post by ckhokie » Wed Jun 18, 2008 6:07 pm

The reason we are trying to use outlook is so we can access the distribution list that are already created. Is there a way to access the distribution list via SMTP? Thanks for your help!

Post Reply
Sign up to our newsletter for free automation tips, tricks & discounts