Skip to main content

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

Author: Kelly Last Modified: 2025-05-13

在日常使用 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 附件的來信將自動移動到垃圾郵件文件夾。


相關文章