Move the emails with spam hyperlinks to Junk E-mail folder

  • Thread starter krity
  • Start date
In summary, the conversation is about a person seeking a way to automatically move incoming emails with specific spam hyperlinks to the Outlook Junk email filter. They have found a potential solution through VBA codes that can be implemented through Outlook.
  • #1
krity
1
0
Hey,

I have a question about Outlook Junk email filter. There are some emails with a few spam hyperlinks which are not recognized by Outlook junk email filter. I have to move them to Junk E-mail folder manually.
And I hope outlook can auto move those incoming email with a few specific spam hyperlinks to Outlook Junk email filter. How can I do that? Thanks.
 
Computer science news on Phys.org
  • #2
Junk email filters don't generally look in the email. They just look at the subject or from address and apply the rules that you set along with others that the provider (Microsoft in this case) might also have.
 
  • #3
It seems that you can do that via VBA codes. I search on google and find one may work to you.

Code:
Public WithEvents objIncomingItems As Outlook.Items

Private Sub Application_Startup()
    Set objIncomingItems = Outlook.Application.Session.GetDefaultFolder(olFolderInbox).Items
End Sub

Private Sub objIncomingItems_ItemAdd(ByVal objItem As Object)
    Dim objMail As Outlook.MailItem
    Dim objWordDocument As Word.Document
    Dim objHyperlinks As Word.Hyperlinks
    Dim i As Long
    Dim strURL As String
    Dim objJunkMailFolder As Outlook.Folder
 
    Set objJunkMailFolder = Application.Session.GetDefaultFolder(olFolderJunk)
 
    If TypeOf objItem Is MailItem Then
       Set objMail = objItem
       Set objWordDocument = objMail.GetInspector.WordEditor
       Set objHyperlinks = objWordDocument.Hyperlinks
 
       If objHyperlinks.Count > 0 Then
          For i = objHyperlinks.Count To 1 Step -1
              strURL = objHyperlinks.Item(i).Address
              'Check if the hyperlink addresses contain specific words
              'You can change the condition as per your needs
              If InStr(LCase(strURL), "www.test.com") > 0 Or InStr(LCase(strURL), "www.sales.com") > 0 Then
                 objMail.Move objJunkMailFolder
              End If
          Next i
       End If
    End If
End Sub

Good luck.
 
Last edited by a moderator:

FAQ: Move the emails with spam hyperlinks to Junk E-mail folder

1. How do I move emails with spam hyperlinks to the Junk E-mail folder?

To move emails with spam hyperlinks to the Junk E-mail folder, you can simply right-click on the email and select "Move to Junk" or "Mark as Junk" depending on your email provider. You can also create a filter or rule to automatically send emails with spam hyperlinks to the Junk E-mail folder.

2. Why should I move emails with spam hyperlinks to the Junk E-mail folder?

Moving emails with spam hyperlinks to the Junk E-mail folder helps to protect your computer and personal information from potential viruses, malware, and phishing scams. It also helps to keep your inbox organized and clutter-free.

3. Will moving emails with spam hyperlinks to the Junk E-mail folder block future emails from the same sender?

Not necessarily. Moving emails to the Junk E-mail folder does not automatically block future emails from the same sender. However, you can block a specific sender or create rules to automatically send emails from certain senders to the Junk E-mail folder.

4. Can I retrieve emails from the Junk E-mail folder?

Yes, you can retrieve emails from the Junk E-mail folder if you accidentally moved them there. Simply go to the Junk E-mail folder, right-click on the email, and select "Not Junk" or "Mark as Not Junk" depending on your email provider.

5. How do I know if an email contains spam hyperlinks?

Most email providers have built-in spam filters that can detect and flag emails with spam hyperlinks. However, you can also look out for suspicious email addresses, subject lines, and content that may indicate the email contains spam hyperlinks.

Similar threads

Replies
15
Views
1K
Replies
34
Views
3K
Replies
24
Views
4K
Replies
23
Views
8K
Replies
5
Views
1K
Replies
2
Views
3K
Replies
5
Views
1K
Back
Top