In order to protect Outlook data against virus attacks, it is always suggested not to access unreliable email attachments. Now, this article will share a way which can make Outlook warn you before you read attachments from unknown senders.
Nowadays, viruses become increasingly rampant and complicated. For instance, email borne viruses have been one of the most common kinds of viruses. Hence, as a type of email client, Outlook is surely a victim. Therefore, you should beware of all potential risks around your Outlook, like unknown email attachments. You should never readily trust and access them. In order to prevent you from being attacked by malicious attachments, here we will show you a method that will let you get confirmed before reading attachments from unknown senders.
Get Warned before Opening Emails Attachments from Unknown Senders
- For a start, access your Outlook application as usual.
- Then, in the main Outlook window, tap on the “Alt + F11” key buttons.
- Next, “Microsoft Visual Basic for Applications” window will display, in which you need to open the “ThisOutlookSession” project.
- Subsequently, copy and paste the piece of VBA code below into this project.
Public WithEvents objInspectors As Outlook.Inspectors Public WithEvents objExplorer As Outlook.Explorer Public WithEvents objMail As Outlook.MailItem Private Sub Application_Startup() Set objInspectors = Outlook.Application.Inspectors Set objExplorer = Outlook.Application.ActiveExplorer End Sub Private Sub objInspectors_NewInspector(ByVal Inspector As Inspector) If TypeOf Inspector.currentItem Is MailItem Then Set objMail = Inspector.currentItem End If End Sub Private Sub objExplorer_SelectionChange() On Error Resume Next If objExplorer.Selection.Item(1).Class = olMail Then Set objMail = objExplorer.Selection.Item(1) End If End Sub 'Occurs when you click or double click on any attachment Private Sub objMail_BeforeAttachmentRead(ByVal Attachment As Attachment, Cancel As Boolean) Dim strSenderAddress As String Dim objContacts As Outlook.Items Dim i As Long Dim strFilter As String Dim objContact As Outlook.ContactItem Dim strMsg As String Dim nPrompt As Integer strSenderAddress = objMail.SenderEmailAddress 'Check if the sender is your contact Set objContacts = Application.Session.GetDefaultFolder(olFolderContacts).Items For i = 1 To 3 strFilter = "[Email" & i & "Address] = " & strSenderAddress Set objContact = objContacts.Find(strFilter) If Not (objContact Is Nothing) Then Cancel = False Exit For End If Next 'If not, prompt you If objContact Is Nothing Then strMsg = "This email is from unknown sender. Are you sure to open the attachments?" nPrompt = MsgBox(strMsg, vbYesNo + vbQuestion, "Confirm Attachment") If nPrompt = vbYes Then Cancel = False Else Cancel = True End If End If End Sub
- After that, you ought to sign this code.
- Later check Outlook macro security settings, insuring digitally signed macros are enabled.
- Finally, you can restart your Outlook to activate this project.
- From now on, every time when you click or double click on attachments of an email from unknown senders, you’ll get a prompt, like the screenshot below:
- If you select “Yes”, the selected attachments will be opened at once.
Immediate Remedy after Outlook Damage
The worst problem in Outlook is undoubtedly Outlook file corruption. Therefore, you need attach great importance to various malicious factors surrounding your Outlook. Also, some preparation is demanded as well, such that you are able to make a quick remedy immediately. For instance, it is highly suggested to get hold of an effectual Outlook fix tool, like DataNumen Outlook Repair. It can check and fix PST files like a cork.
Shirley Zhang is a data recovery expert in DataNumen, Inc., which is the world leader in data recovery technologies, including damaged mdf and outlook repair software products. For more information visit www.datanumen.com