在将电子邮件发送到Outlook中的外部域之前发出警告 [英] Warn before sending emails to external domains in Outlook
问题描述
如果您要发送和通过电子邮件发送到外部域,如何获取 Outlook
来警告您?
How can you get Outlook
to warn you if you are about to send and email to an external domain?
每天发送大量电子邮件,总是有可能错误地将电子邮件发送给错误的人.当他们是客户或公司以外的人时,这尤其成问题.
Sending large amounts of emails everyday it is always possible to incorrectly send one to the wrong person. This is especially a problem when they are clients or people outside of your company.
使用 Alt + Enter
为我输入电子邮件后快速发送电子邮件通常是原因,因为我没有彻底检查收件人.
Using Alt + Enter
to quickly send emails after typing them for me is often the cause as I do not check the recipients thoroughly.
我发现了很多实施情况都不理想,所以我想在下面分享我的观点...
推荐答案
感谢ojhhawkins提供上述代码-确实有用.我做了一个简单的迭代,在MsgBox文本中包含了一个外部电子邮件地址列表.
Thanks ojhhawkins for the code above - really useful. I've done a simple iteration to include a list of the external email addresses in the MsgBox text.
警告语-我注意到当您在其他程序(例如Excel,Adobe Reader等)中使用以电子邮件发送附件"时,没有出现警告./users/1571407/niton> niton 指出:
Word of caution - I've noticed that the warning doesn't appear when you use the Send As Email Attachment in other programmes, eg Excel, Adobe Reader etc. As niton pointed out:
Re:在其他程序中作为电子邮件附件发送.在此处的注释中描述outlookcode.com/d/code/setsavefolder.htm"...不适用于使用Office程序中的File | Send命令或Windows Explorer或其他程序中的类似命令创建的消息.这些命令调用Simple MAPI,绕过Outlook功能."
Re:Send As Email Attachment in other programmes. Described in notes here outlookcode.com/d/code/setsavefolder.htm "... does not work on messages created with File | Send commands in Office programs or similar commands in Windows Explorer or other programs. Those commands invoke Simple MAPI, which bypasses Outlook functionality."
Private Sub Application_ItemSend(ByVal Item As Object, Cancel As Boolean)
Dim recips As Outlook.Recipients
Dim recip As Outlook.Recipient
Dim pa As Outlook.PropertyAccessor
Dim prompt As String
Dim strMsg As String
Const PR_SMTP_ADDRESS As String = "http://schemas.microsoft.com/mapi/proptag/0x39FE001E"
Set recips = Item.Recipients
For Each recip In recips
Set pa = recip.PropertyAccessor
If InStr(LCase(pa.GetProperty(PR_SMTP_ADDRESS)), "@example.com") = 0 Then
strMsg = strMsg & " " & pa.GetProperty(PR_SMTP_ADDRESS) & vbNewLine
End If
Next
If strMsg <> "" Then
prompt = "This email will be sent outside of example.com to:" & vbNewLine & strMsg & "Do you want to proceed?"
If MsgBox(prompt, vbYesNo + vbExclamation + vbMsgBoxSetForeground, "Check Address") = vbNo Then
Cancel = True
End If
End If
End Sub
要将此代码实际添加到Outlook应用程序中:
To actually add this code to your Outlook application:
- 如果在功能区栏中看不到开发人员"选项卡,请转到文件/选项,选择左侧的自定义功能区,然后勾选 Developer在右侧.
- 从 Developer 标签中选择 Visual Basic .
- 展开Project1,Microsoft Outlook对象,然后双击ThisOutlookSession(左上角).
- 将上面的代码粘贴到模块中.
- 将复制的代码中的"example.com"替换为您的域.
- 关闭VBA编辑器并将更改保存到模块中.
- 在 Developer 选项卡上,单击 Macro Security ,然后将级别更改为所有宏的通知或更低.
- 重新启动Outlook.(上面的代码不会另外初始化.)
- If you can't see the Developer tab in the ribbon bar, go to File/Options, choose Customise Ribbon on the left, and tick Developer on the right.
- From the Developer tab choose Visual Basic.
- Expand Project1, Microsoft Outlook Objects, and double-click ThisOutlookSession (top left).
- Paste the code above into the module.
- Replace the "example.com" in the copied code to your domain.
- Close the VBA editor and save changes to the module.
- On the Developer tab click Macro Security, and change the level to Notifications for all macros or lower.
- Restart Outlook. (The code above will not initialise otherwise.)
这篇关于在将电子邮件发送到Outlook中的外部域之前发出警告的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!