Disable warning about a program trying to send an email

感情迁移 提交于 2021-02-10 14:40:09

问题


I send an email using Outlook 2010 with Access VBA.

I get a warning from Microsoft Outlook about a program trying to send an email and I'm forced to push allow.

I have the Microsoft Outlook Object Library 14 from the reference in VBA.

In Outlook - Options - access through programin is marked on don't show warnings.

I added the next entries in regedit

Key: HKEY_CURRENT_USER\Software\Policies\Microsoft\Office\ 
<version>\Outlook\Security
Value name: AdminSecurityMode
Value type: REG_DWORD
Value: 3

Key: HKEY_CURRENT_USER\Software\Policies\Microsoft\Office\ 
<version>\Outlook\Security
Value name: PromptOOMSend
Value name: PromptOOMAddressBookAccess
Value name: PromptOOMAddressInformationAccess
Value name: PromptOOMMeetingTaskRequestResponse
Value name: PromptOOMSaveAs
Value name: PromptOOMFormulaAccess
Value name: PromptSimpleMAPISend
Value name: PromptSimpleMAPINameResolve
Value name: PromptSimpleMAPIOpenMessage
Value type: REG_DWORD
Value: 2

I also add DoCmd.SetWarnings False in the email function.

How to disable this warning?


回答1:


The common way to solve this is to install and use Outlook Redemption .

Another method is to bypass Outlook completely and send via SMTP, but that is another story and requires a lot more code.




回答2:


You get a standard security prompt in Outlook.

There are several ways for supressing such prompts:

  1. Use a third-party components for supressing Outlook security warnings. See Security Manager for Microsoft Outlook for more information.

  2. Use a low-level API instead of OOM. Or any other third-party wrappers around that API, for example, Redemption.

  3. Develop a COM add-in which has access to the trusted Application object.

  4. Use group policy objects for setting up machines.




回答3:


The warning appears for using DoCmd.sendObject to send an email, so instead of downloading thir party components.

I just not used doCmd.sendObjects and used a function like this:

 Public Function CreateNewMessage()
 Dim objMsg As MailItem

 Set objMsg = Application.CreateItem(olMailItem)

 With objMsg
.To = "Alias@domain.com"
.CC= "Alias2@domain.com"
.BCC = "Alias3@domain.com"
.Subject = "This is the subject"
.Categories = "Test"
.VotingOptions = "Yes;No;Maybe;"
.BodyFormat = olFormatPlain ' send plain text message
.Importance = olImportanceHigh
.Sensitivity = olConfidential
.Attachments.Add ("path-to-file.docx")

' Calculate a date using DateAdd or enter an explicit date
.ExpiryTime = DateAdd("m", 6, Now) '6 months from now
.DeferredDeliveryTime = #8/1/2012 6:00:00 PM#

.Display
End With

Set objMsg = Nothing
End Function

Thank you so much



来源:https://stackoverflow.com/questions/57288875/disable-warning-about-a-program-trying-to-send-an-email

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!