View Single Post
  #8  
Old March 12th 06, 11:29 AM posted to microsoft.public.outlook.program_vba
Spectre
external usenet poster
 
Posts: 12
Default last solution

Last release to add spam addresses in the list of blocked addresses. It
deletes also the spams.

Sub addSpamAdress() ' ajoute toutes les adresses des span à la liste
d'expéditeur indésirables
'On Error Resume Next

Dim olItem As Mailitem
Dim objInbox As MAPIFolder
Dim oSelection
Dim arc As Outlook.MAPIFolder
Dim junkMailAddress As String
Dim response As String

Set objNS = Application.GetNamespace("MAPI")
Set objInbox = objNS.GetDefaultFolder(olFolderJunk)
Set oSelection = objInbox.Items

response = MsgBox("Your are going to add all the email addresses
to the Bocked Email list" & vbCrLf & _
"All emails will be deleted",
vbYesNoCancel, "Junk Mail")

If response = vbNo Or response = vbCancel Then
Exit Sub
Else
For I = 1 To oSelection.Count
Set olItem = oSelection.Item(I)
If oSelection.Count 0 Then ' si il ya de s
mails
junkMailAddress = olItem.SenderEmailAddress
If junkMailAddress "" Then

Set Btn =
Application.ActiveExplorer.CommandBars.FindControl (1, 9786)
Btn.Execute
olItem.Delete

End If
End If
Next
End If
End Sub



Spectre a formulé la demande :
Hi,

Even if spammers use often a new address for each spam they send, it is not
always the case.

Hence, I am looking for a function which could add on one click all the email
addresses of the spams beeing in the unsollicited email folder (a translation
from French for "courrier indésirable")! to the list of unsollicited mail
addresses.
I have tried to do it myself but I have been unable to find the name of this
list.

Thanks



Ads