'Move mail to "Junk Email" folder and create a spam rule

I'd like to move the selected email to the "Junk Email" folder and create a spam rule for that email address that automatically sends all future emails from that address to my junk email.



Solution 1:[1]

To move a message, try something like the following (off the top of my head)

if Application.ActiveExplorer.Selection.Count > 0 Then
  set Folder = Application.Session.GetDefaultFolder(olFolderJunk)
  set Msg = Application.ActiveExplorer.Selection.Item(1)
  Msg.Move(Folder)
End If

Outlook Object Model does not expose Junk mail settings. If using Redemption (I am its author) is an option, it exposes the RDOJunkEmailOptions.BlockedSenders.Add method.

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1