My OS is windows 7, like everyone I get tons of junk mail and I try to put them in the block list, but still they get thru. I am trying to see if I can list the people who send me these junk mail and then maybe put them in the Blocjk List as a List.
Using a previous code, I wrote something. But instead of listing the From receipients, it is different result. Frankly I do not know where to tweak the code. The result is it is giving my own email address.
I want to run this when I select my Junk folder, and then click on the macro and run it.
Hope a Guru could take a look and please correct it for me. thank u.
Dim outputFile As Object
Dim objFSO As Object
Dim recip As Recipient
Const strFileSpec As String = "c:\Deleteme\JunkMail.txt"
If Application.ActiveExplorer.Selection.Count <> 1 Then Exit Sub
MsgBox " I am inside the app "
On Error Resume Next
Set objFSO = CreateObject("scripting.filesystemobject")
Set outputFile = objFSO.opentextfile(strFileSpec, 8)
On Error GoTo 0
If outputFile Is Nothing Then Set outputFile = objFSO.createtextfile(strFileSpec, True)
' Set outputFile = objFSO.createtextfile(strFileSpec, True)
For Each recip In Application.ActiveExplorer.Selection(1).Recipients
If recip.Type = olTo Then
outputFile.Writeline "End of file" & " " & Now()
Set outputFile = Nothing
MsgBox "end of processing "