INTELLIGENT WORK FORUMS
FOR COMPUTER PROFESSIONALS

Log In

Come Join Us!

Are you a
Computer / IT professional?
Join Tek-Tips Forums!
  • Talk With Other Members
  • Be Notified Of Responses
    To Your Posts
  • Keyword Search
  • One-Click Access To Your
    Favorite Forums
  • Automated Signatures
    On Your Posts
  • Best Of All, It's Free!

*Tek-Tips's functionality depends on members receiving e-mail. By joining you are opting in to receive e-mail.

Posting Guidelines

Promoting, selling, recruiting, coursework and thesis posting is forbidden.

Jobs

Issue with Outlook email via OLE

Issue with Outlook email via OLE

(OP)
Hi,
I am trying to generate and display an email with Outlook using OLE objects.
This was working until a security update was applied to Windows and Outlook [Win 10, Outlook 2010].
Now, a popup appears with the following message.
A program is trying to send an e-mail message on your behalf.
[Allow] [Deny].
The problem is that when I click Allow, the email does not get displayed so the user can send it and I cannot figure out how to debug this.
I am pretty sure that the Outlook setting causing this is
[Warn me about suspicious activity when my antivirus software is inactive or out of date]
which is accessed in Outlook via File-> Options-> Trust Center-> Trust Center Settingsā€¦-> Programmatic Access
The problem is that I do not have administrative privileges and have been told that regardless we will not be allowed to disable this setting for security reasons.

My goal is to figure out why ALLOW is not letting the email get created/displayed.
It does not appear that the OLE Item functions provide a return status to indicate success or failure.

Prior to the update, the emails got displayed and could be sent without problems.
Sample code below:


// Use Ole code for Outlook
ole_outlook = Create OLEObject

TRY
// specify the COM "progID" that the class is registered with.
li_retval = ole_outlook.ConnectToNewObject("outlook.application")

// ConnectToNewObject() Returns 0 if it succeeds
// and one of the following values [below] if an error occurs:
IF li_retval < 0 THEN
// ConnectToNewObject() Error detected
Messagebox('Error','Error connecting to Outlook Email client. Error Code: ' + string(li_retval))
Return -1
END IF
CATCH (runtimeerror a)
Messagebox('Error','Error caught connecting to Outlook Email client. Process terminating.')
RETURN -1
END TRY

// Creates a new mail Item
ole_item = ole_outlook.CreateItem( 0 ) // '0' Mail Item

ole_item.To = 'Recipient Email Addr Goes Here'
ole_item.Subject = 'Test Email Subject'
ole_item.Display //displays the message without sending

--------------------------------------------------------------
This is when the popup dialog appears
A program is trying to send an e-mail message on your behalf.
[Allow] [Deny]
If I select Allow, the email still does not get displayed.
I cannot figure out how to troubleshoot.
--------------------------------------------------------------

I appreciate any suggestions.
Thanks

Red Flag This Post

Please let us know here why this post is inappropriate. Reasons such as off-topic, duplicates, flames, illegal, vulgar, or students posting their homework.

Red Flag Submitted

Thank you for helping keep Tek-Tips Forums free from inappropriate posts.
The Tek-Tips staff will check this out and take appropriate action.

Reply To This Thread

Posting in the Tek-Tips forums is a member-only feature.

Click Here to join Tek-Tips and talk with other members!

Resources

Close Box

Join Tek-Tips® Today!

Join your peers on the Internet's largest technical computer professional community.
It's easy to join and it's free.

Here's Why Members Love Tek-Tips Forums:

Register now while it's still free!

Already a member? Close this window and log in.

Join Us             Close