What causes Outlook 2007 to prompt "A program is trying to send an e-mail message on your behalf?"
Asked Answered
A

4

4

I have a custom form built within Outlook that sends an email notification any time a change is made. Because of the specifications of the form, I had to add a bit of VBScript (unfortunately) to the form that does the emailing on the closing event of the form.

The form is currently published and works well. The only problem that appears to be cropping up is that I am the only one of the users that use the form that gets prompted with the following dialog:

enter image description here

Nobody else that uses the form is getting the dialog. This dialog box forces you to wait until the progress bar is complted before it "Allow"s you to send the email (about 5 seconds). Is it because I am the publisher? Or is it a client side setting that I am running into? How do I disable this puppy?

In case its relevant heres the source:

Sub SendAttach() 
   'Open mail, adress, attach report
   Dim objOutlk             'Outlook
   Dim objMail                  'Email item
   Dim strMsg
   Const olMailItem = 0

  'Create a new message
   set objOutlk = createobject("Outlook.Application")
   set objMail = objOutlk.createitem(olMailItem)
   objMail.To = Item.UserProperties("Assigned To")
   objMail.cc = Item.UserProperties("Bcc")

   'Set up Subject Line
   objMail.subject = "Work Order Notifications: " & Item.UserProperties("Work Order Number") & " - " & _
                Item.UserProperties("Subject") & " Due " & Item.UserProperties("Due Date")

   'Add the body    
   strMsg = Item.UserProperties("Specifications") & vbcrlf
   strMsg = strMsg & Item.UserProperties("Constraints")

   objMail.body = strMsg
   objMail.display 'Use this to display before sending, otherwise call objMail.Send to send without reviewing

   objMail.Send
   'Clean up
   set objMail = nothing
   set objOutlk = nothing
End sub

Security here is not a concern. If somebody has managed to start sending emails from my workstation, I have much bigger problems than email spoofing!

As side note, I couldn't decide if SO or SU was the best place for this question. Please redirect accordingly if necessary.

Anxiety answered 4/5, 2012 at 20:24 Comment(3)
I don't want to rewrite what's already been well written. Take a look at your somewhat limited options here: outlookcode.com/article.aspx?id=52Brokendown
And BTW, the behavior you're seeing can vary from one machine to another depending on which version of MS Office is being used and which updates have been installed, as well as their MS Office security settings.Brokendown
Does this answer your question? How can I avoid Outlook's security warning when sending email programmatically?Lollop
C
3

I ran into this problem a while back whilst trying to accomplish somehting slightly different, but for this purpose is the same. The link HK has provided makes for good reading and helps to understand what's going on, however in the end I chose not to go with any of the options discussed on the page. Instead I kept it simple and decided to fool outlook into thinking I was sending the e-mail rather than an automated process, I did this by replacing the objMail.Send with a SendKeys alternate to mimic myself pressing the send button, bit ugly but worked in my case.

Edit:

You can use this sendkeys statement:

SendKeys "%{s}", 1

This basically calls Alt + S which triggers the outlook send button.

Compete answered 8/5, 2012 at 8:7 Comment(2)
I am not super familiar with VBS. Can the SendKeys method be invoked inline with form object (like Me.SendKeys("{ENTER}") or do I have to create a WScript object to the sending?Anxiety
I have added the Alt+S sendkeys method I used, it can be used inline without a separate Wscript as long as the outlook window has the focusCompete
P
1

Three options

- Use a pc without the MS Outlook security patch
- Use the redemption ocx (google it up to download)
- Use SMTP instead of outlook

For the second option here an example

Function sendmail2 (sRecipient, sSubject, sMsg, sAttach)
    on error resume next
    dim SafeItem, oItem  
    set SafeItem = CreateObject("Redemption.SafeMailItem") 'Create an instance of Redemption.SafeMailItem 
    set oItem = oApp.CreateItem(0) 'Create a new message
    With SafeItem
      .Item = oItem 'set Item property 
      .Recipients.Add sRecipient
      .Recipients.ResolveAll 
      .Subject = sSubject
      .HTMLBody = sMsg
      .Send 
    End With
  End Function
Ply answered 8/5, 2012 at 9:54 Comment(0)
E
0

I ran into the same problem and because my application runs on Windows 7 I was able to use Windows Mail Client (wlmail.exe) to send emails instead of MS Outlook. With Wlmail, the warning still comes in the default behavior but there is an option to turn off the warning by going to Options > Security tab and once you turn it off the program can send mails without bringing up a pop up.

Entertain answered 20/10, 2015 at 21:40 Comment(0)
B
0

Another possible workaround is to update the registry setting on your machine.

https://support.microsoft.com/en-gb/help/3189806/a-program-is-trying-to-send-an-e-mail-message-on-your-behalf-warning-i

This link outlines how to identify the relevant registry key and what value should be set. This allows you to override Trust Center settings.

Blalock answered 16/2, 2019 at 1:48 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.