跳至主要内容

如何在Outlook中阻止带有zip(文件)附件的邮件?

Author: Kelly Last Modified: 2025-05-07

在日常使用Outlook时,您可能会收到数百封带有.zip附件的垃圾邮件。在此,本教程将介绍一种解决方案,以阻止Outlook中所有带有.zip附件的邮件。

在Outlook中阻止带有zip(文件)附件的邮件

Office Tab - 在 Microsoft Office 中启用标签页编辑和浏览,让工作变得轻松愉快。
立即解锁 Kutools for Outlook 的免费版本,永久享受超过 70 项功能的无限访问权限。
通过这些高级功能增强您的 Outlook 2024 - 2010 或 Outlook 365。享受 70 多种强大功能,提升您的邮件体验!

arrow blue right bubble在Outlook中阻止带有zip(文件)附件的邮件

此方法将介绍一个VBA,并通过该VBA脚本创建规则,自动阻止Outlook中所有带有.zip附件的邮件。请按照以下步骤操作:

1. 在Outlook中,同时按下 Alt + F11 键打开 Microsoft Visual Basic for Applications 窗口。

2. 单击 插入 > 模块,然后将以下VBA代码粘贴到新的模块窗口中。

VBA:将带有.zip附件的邮件移动到垃圾邮件文件夹

Dim I As Long
'Check each attachment
For I = 1 To Item.Attachments.Count
'If the attachment's file name ends with .zip
If Right(UCase(Item.Attachments.Item(I).FileName), 4) = ".ZIP" Then
'Move the message to Junk E-mail
Item.Move Application.Session.GetDefaultFolder(olFolderJunk)
'No need to check any of this message's remaining attachments
Exit For
End If
Next I
End Sub

3. 保存VBA代码,并关闭 Microsoft Visual Basic for Applications 窗口。

4. 现在返回到Outlook主界面。选择指定邮箱账户中的任意邮件,然后单击 开始 > 规则 > 管理规则和通知。参见截图:

the screenshot of step about blocking emails with zip (files) attachments in Outlook 1

5. 在“规则和通知”对话框中,请单击“电子邮件规则 ”选项卡下的 新建规则 。参见截图:

the screenshot of step about blocking emails with zip (files) attachments in Outlook 2

6. 现在规则向导已打开。请选择“对我接收的邮件应用规则 ”选项并单击 下一步 按钮。参见截图:

the screenshot of step about blocking emails with zip (files) attachments in Outlook 3

7. 在规则向导(选择条件)中,请勾选 带有附件 选项,并单击 下一步 按钮。参见截图:

the screenshot of step about blocking emails with zip (files) attachments in Outlook 4

8. 在规则向导(选择操作)中,请按以下截图所示进行操作:(1) 勾选 运行脚本 选项;(2) 单击 第2步 部分中的脚本文本;(3) 在“选择脚本”对话框中选择新添加的VBA脚本,并单击 确定 按钮;(4) 单击 下一步 按钮。

the screenshot of step about blocking emails with zip (files) attachments in Outlook 5

9. 直接在规则向导(选择例外)中单击 下一步 按钮。

10. 现在在最后一个规则向导中,请(1) 在第1步框中为新规则命名,(2) 根据需要在 第2步 部分指定选项,然后(3) 单击 完成 按钮。参见截图:

the screenshot of step about blocking emails with zip (files) attachments in Outlook 6

11. 关闭“规则和通知”对话框。

至此,您已经完成了使用指定VBA脚本的规则设置。所有带有.zip附件的来信都将自动移至垃圾邮件文件夹。


相关文章