2002 - How to delete PIF & EXE files?

  • Thread starter Thread starter SOX FAN
  • Start date Start date
S

SOX FAN

Using Outlook 2002 on 98SE machine.

Question: I want to have Outlook 2002 "delete" any email that arrives
with the PIF or EXE attachment.

Thank you.
 
-----Original Message-----
Using Outlook 2002 on 98SE machine.

Question: I want to have Outlook 2002 "delete" any email that arrives
with the PIF or EXE attachment.

Thank you.
.

It is possible!
If you search the newgroup for removing attachment
security you will find a registry fix, that you could use
the other way round :)
 
Mike, are you saying that the only way to do this is to reverse engineer a
"registry fix" that "allows" PIF and EXE files? I want to "delete" them
when they arrive.

Also you wrote, in your first line: "It is possible!" If you know how to do
what I'm asking would please share it with me, I thought the solution would
be a lot less cryptic.

Thank you very much
 
I wasn't trying to be cryptic.

You could use VB Script to delete the attachments!!

You will need to capture the newmail event, the use the
item.attachments object to check the extension

I don't really have the time to write the vb code for
you..

I am sure you will find all the info you need in the help
file of the Visual Basic Script editor.

If not, let me know and I will see what I can do..
 
Here is something I have 'thrown' together!

This will throw up an error if a receipt is in the
mailbox.

Dim objInbox As MAPIFolder
Dim olitems As Items
Dim objMailItem As MailItem

Private Sub Application_NewMail()
Set objInbox = Outlook.Session.GetDefaultFolder
(olFolderInbox)
Set objitems = objInbox.Items

For Each objMailItem In objitems

For i = 1 To objMailItem.Attachments.Count
If InStr(1, objMailItem.Attachments.Item
(i).filename, ".bat") Or InStr(1,
objMailItem.Attachments.Item(i).filename, ".pif") Then
objMailItem.Attachments.Remove (i)
MsgBox "Suspicious attachment removed!"
End If
Next
Next
End Sub
 
This one should be error free
or at least it is in ol2003

Dim objInbox As MAPIFolder
Dim olitems As Items
Dim objMailItem As MailItem


Private Sub Application_NewMail()
Set objInbox = Outlook.Session.GetDefaultFolder
(olFolderInbox)
Set objitems = objInbox.Items

For Each objMailItem In objitems
If objMailItem.Class = olMail Then
For i = 1 To objMailItem.Attachments.Count
If InStr(1, objMailItem.Attachments.Item
(i).filename, ".bat") Or InStr(1,
objMailItem.Attachments.Item(i).filename, ".pif") Then
objMailItem.Attachments.Remove (i)
MsgBox "Suspicious attachment removed!"
End If
Next
End If
Next
End Sub
 
Whoops! Thats what you get for rushing me..

This time it saves the ammended mail item!

Dim objInbox As MAPIFolder
Dim olitems As Items
Dim objMailItem As MailItem


Private Sub Application_NewMail()
Set objInbox = Outlook.Session.GetDefaultFolder
(olFolderInbox)
Set objitems = objInbox.Items

For Each objMailItem In objitems
If objMailItem.Class = olMail Then
For i = 1 To objMailItem.Attachments.Count
If InStr(1, objMailItem.Attachments.Item
(i).filename, ".doc") Or InStr(1,
objMailItem.Attachments.Item(i).filename, ".pif") Then
objMailItem.Attachments.Remove (i)
objMailItem.Save
MsgBox "Suspicious attachment removed!"

End If
Next
End If
Next
End Sub
 
Call me "stupid"

I opened the VP Script Editor, project1 - Microsoft Outlook Objects -
ThisOutlookSession - NEW WINDOW OPENS (Project1 ThisOutlookSession Code) -
Application Radio Button (Left) - New Mail Radio Button (Right) - Placed:

Dim objInbox As MAPIFolder
Dim olitems As Items
Dim objMailItem As MailItem


Private Sub Application_NewMail()
Set objInbox = Outlook.Session.GetDefaultFolder
(olFolderInbox)
Set objitems = objInbox.Items

For Each objMailItem In objitems
If objMailItem.Class = olMail Then
For i = 1 To objMailItem.Attachments.Count
If InStr(1, objMailItem.Attachments.Item
(i).filename, ".bat") Or InStr(1,
objMailItem.Attachments.Item(i).filename, ".pif") Then
objMailItem.Attachments.Remove (i)
MsgBox "Suspicious attachment removed!"
End If
Next
End If
Next
End Sub

Now what? I'm lost........... Thank you for you help
 
It will then fire each time a mail item is received.

all you need to do is paste the text straight into the
pane that pops up..

Don't select anything..

:)

Then send a test e-mail to yourself..
 
Thank you

I'll try it

I get an error message in the window but perhaps it just need to run.

Thank you again for your help. It is much appreciated.
 
I THINK IT WORKED!!!!!!!! Do I need a separate one for "exe" and other
files or can I add those extent ions to the script you wrote?

PS where did the e-mail go? Is it still on my PC or was it perm deleted?

THANK YOU! YOU'RE A GENIUS!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
 
?? The e-mail ??

You mean the attachment?
Permanantly deleted....

Add this line before the remove line, and ammend as needed
objMailItem.Attachments.Item(i).SaveAsFile SaveAs
("C:\Quarenteen\" & objMailItem.Attachments.Item
(i).filename)



You can just extend the script if you wish:

If InStr(1, objMailItem.Attachments.Item
(i).filename, ".bat") Or InStr(1,
objMailItem.Attachments.Item(i).filename, ".pif") or
InStr(1, objMailItem.Attachments.Item
 
If you wanted to be really cleaver, I would remove the
msgbox line and do objmailitem.body = objmailitem.body &
vbcrlf & vbcrlf & vbclrf & "I removed an attachment from
this e-mail, cuz it may av been a virus!" I try to avoid
this because sometimes it removes the body of the e-mail
for no appernt reason ????¿¿¿¿
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top