A Microsoft Outlook email forum. Outlook Banter

If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

Go Back   Home » Outlook Banter forum » Microsoft Outlook Email Newsgroups » Outlook and VBA
Site Map Home Register Authors List Search Today's Posts Mark Forums Read Web Partners

adding at once all the email addresses of the spammers in the list of unwanted /unsollicited mails



 
 
Thread Tools Search this Thread Display Modes
  #1  
Old March 8th 06, 11:44 AM posted to microsoft.public.outlook.program_vba
Spectre
external usenet poster
 
Posts: 1
Default adding at once all the email addresses of the spammers in the list of unwanted /unsollicited mails

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
--
Spectre


  #2  
Old March 8th 06, 07:22 PM posted to microsoft.public.outlook.program_vba
Eric Legault [MVP - Outlook]
external usenet poster
 
Posts: 830
Default adding at once all the email addresses of the spammers in the list

For versions prior to 2003, Outlook stores the list of blocked senders in
this file:

C:\Documents and Settings\user\Application Data\Microsoft\Outlook\Junk
Senders.txt

However, if you have Outlook 2003 you are out of luck. Otherwise, all you
need to do is append e-mail addresses to this file. A good way is to use the
TextStream object from the Microsoft Scripting Runtime Library (VBScript).

To get a handle to the selected e-mail, use the Explorer.Selection property.
For an open e-mail, use Inspector.CurrentItem. In both cases, get the value
of the MailItem.SenderEmailAddress. Note that accessing this property will
cause the security warning dialog to appear. See this link for more info:

Microsoft Outlook "Object Model Guard" Security Issues for Developers:
http://www.outlookcode.com/d/sec.htm

--
Eric Legault (Outlook MVP, MCDBA, old school WOSA MCSD, B.A.)
Try Picture Attachments Wizard for Outlook:
http://www.collaborativeinnovations.ca
Blog: http://blogs.officezealot.com/legault/


"Spectre" wrote:

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
--
Spectre



  #3  
Old March 9th 06, 07:49 AM posted to microsoft.public.outlook.program_vba
Michael Bauer
external usenet poster
 
Posts: 435
Default adding at once all the email addresses of the spammers in the list of unwanted /unsollicited mails

Am Wed, 8 Mar 2006 11:44:37 +0100 schrieb Spect

Because you cannot add multiple items at once via CommandBars this could be
a workaround:

1. You do have all selected items in ActiveExplorer.Selection. Keep that
list.
2. Create an empty folder
3. Switch to that folder
4. Copy one item from your selection into that folder. The item should be
the selected one now.
5. Call the CommmandBarButton.Execute (e.g. ID 9786 in OL 2003 for the
button "Add to blocked senders")
6. Delete that item from the folder
7. Go on with step 4 as long as the list contains items
8. No you could delete the created folder or keep it for the next time


--
Viele Gruesse / Best regards
Michael Bauer - MVP Outlook
-- www.vbOffice.net --


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

  #4  
Old March 9th 06, 10:03 AM posted to microsoft.public.outlook.program_vba
Spectre
external usenet poster
 
Posts: 12
Default adding at once all the email addresses of the spammers in the list of unwanted /unsollicited mails

hi,
thanks for your answers. I'll varry on with your ideas.

Bye


Spectre a pensé très fort :
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



  #5  
Old March 11th 06, 10:48 PM posted to microsoft.public.outlook.program_vba
Spectre
external usenet poster
 
Posts: 12
Default adding at once all the email addresses of the spammers in the list of unwanted /unsollicited mails

Well, I have found a solution which is not the most professionnal one,
but it works.

I use the Sendkeys function . Using a French release of outlook, the
Senkeys "letters" must be most probably changed.

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

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


For I = 1 To oSelection.Count
Set olItem = oSelection.Item(I)
If oSelection.Count 0 Then ' si il ya des mails
junkMailAddress = olItem.SenderEmailAddress
If junkMailAddress "" Then
' *******************************
SendKeys "%SSB" ' here the changes to do
' *******************************
End If
End If
Next
End Sub

Spectre a émis l'idée suivante :
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



  #6  
Old March 11th 06, 11:28 PM posted to microsoft.public.outlook.program_vba
Spectre
external usenet poster
 
Posts: 12
Default adding at once all the email addresses of the spammers in the list of unwanted /unsollicited mails

Better,
replace the Sendkeys line with :
Set Btn = Application.ActiveExplorer.CommandBars.FindControl (1, 9786)


Spectre a formulé la demande :
Well, I have found a solution which is not the most professionnal one, but it
works.

I use the Sendkeys function . Using a French release of outlook, the Senkeys
"letters" must be most probably changed.

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

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


For I = 1 To oSelection.Count
Set olItem = oSelection.Item(I)
If oSelection.Count 0 Then ' si il ya des mails
junkMailAddress = olItem.SenderEmailAddress
If junkMailAddress "" Then
' *******************************
SendKeys "%SSB" ' here the changes to do
' *******************************
End If
End If
Next
End Sub

Spectre a émis l'idée suivante :
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



  #7  
Old March 13th 06, 08:37 AM posted to microsoft.public.outlook.program_vba
Michael Bauer
external usenet poster
 
Posts: 435
Default adding at once all the email addresses of the spammers in the list of unwanted /unsollicited mails

Am Sat, 11 Mar 2006 22:48:41 +0100 schrieb Spect

Unfortunately you´ve opened a new thread for the same topic. Please see my
answers in "last solution".

--
Viele Gruesse / Best regards
Michael Bauer - MVP Outlook
-- www.vbOffice.net --


Well, I have found a solution which is not the most professionnal one,
but it works.

I use the Sendkeys function . Using a French release of outlook, the
Senkeys "letters" must be most probably changed.

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

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


For I = 1 To oSelection.Count
Set olItem = oSelection.Item(I)
If oSelection.Count 0 Then ' si il ya des mails
junkMailAddress = olItem.SenderEmailAddress
If junkMailAddress "" Then
' *******************************
SendKeys "%SSB" ' here the changes to do
' *******************************
End If
End If
Next
End Sub

Spectre a émis l'idée suivante :
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

  #8  
Old March 12th 06, 12:29 PM 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



  #9  
Old March 13th 06, 08:49 AM posted to microsoft.public.outlook.program_vba
Michael Bauer
external usenet poster
 
Posts: 435
Default last solution

Am Sun, 12 Mar 2006 12:29:10 +0100 schrieb Spect

Did you test that solution also for the case that really several items are
selected?

As I wrote in your former thread, the button you refer to isn´t enabled if
more than one item is selected.

Additionally the For Next loop doesn´t work if you do have more than one
item in the list and delete them. In that case your loop must count
backwards:

For i=oSelection.Count To 1 Step -1
....
Next

No errors but hopefully useful tipps for you:

For I = 1 To oSelection.Count
Set olItem = oSelection.Item(I)
If oSelection.Count 0 Then ' si il ya de s
mails


If the loop starts, i.e. if the execution goes on with the last line, then
you do know already that Count 0. There´s no need to ask that again.

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


The button is always the same. It slows down the execution if you set the
variable within the loop again and again.

--
Viele Gruesse / Best regards
Michael Bauer - MVP Outlook
-- www.vbOffice.net --


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

  #10  
Old March 14th 06, 10:10 PM posted to microsoft.public.outlook.program_vba
Spectre
external usenet poster
 
Posts: 12
Default last solution

Hi,

Thanks for your comments and your help.

For sure the " If oSelection.Count 0 Then" is not necessary!
For the other points :
- i don't select all the items to delete but only one, and it works (it
adds all the adresses in the blocked list and deletes all the mails in
the directory) but... only if I have first deleted a email in the
"ordinary way" and I don't understand why.

If you can help me on this....

Thanks an dbye



Après mûre réflexion, Michael Bauer a écrit :
Am Sun, 12 Mar 2006 12:29:10 +0100 schrieb Spect

Did you test that solution also for the case that really several items are
selected?

As I wrote in your former thread, the button you refer to isn´t enabled if
more than one item is selected.

Additionally the For Next loop doesn´t work if you do have more than one
item in the list and delete them. In that case your loop must count
backwards:

For i=oSelection.Count To 1 Step -1
...
Next

No errors but hopefully useful tipps for you:

For I = 1 To oSelection.Count
Set olItem = oSelection.Item(I)
If oSelection.Count 0 Then ' si il ya de s
mails


If the loop starts, i.e. if the execution goes on with the last line, then
you do know already that Count 0. There´s no need to ask that again.

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


The button is always the same. It slows down the execution if you set the
variable within the loop again and again.

--
Viele Gruesse / Best regards
Michael Bauer - MVP Outlook
-- www.vbOffice.net --


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



 




Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Spammers using Outlook to email-bomb sites David Wicks Outlook - General Queries 7 February 24th 06 09:32 PM
how to remove addresses from contacts list? me Outlook - Using Contacts 1 February 9th 06 08:38 AM
How do I find the number of email addresses in a distribution list Shockle Outlook - Using Contacts 1 January 30th 06 11:13 PM
message rules - can I import a list of email addresses? Alynn Baker Outlook Express 3 January 27th 06 03:36 PM
Adding Members to a Distribution List DeeW Outlook - Using Contacts 2 January 24th 06 09:20 PM


All times are GMT +1. The time now is 11:25 AM.


Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.Search Engine Friendly URLs by vBSEO 2.4.0
Copyright ©2004-2025 Outlook Banter.
The comments are property of their posters.