HOW TO STOP SPAM -- join the fight!

GadgetLover

Senior Member & Tech Guru
First, join SpamCop.net!! It is awesome! I use it DAILY. They offer a "free" spam reporting service that has basic functionality and "pay" services for more robust spam handling and reporting.

Second, in conjunction with SpamCop -- in fact, to use SpamCop (once you've registered) -- create a "Report Spam" script (call it 'Report Spam\cS') [I will provide the code for you below -- thanks to the author that created the script!]

Third, create a "Bounce Spam\cB" Script [I will provide the code for you below -- thanks to the author that created the script!]

Fourth, make sure that your SpamCop email address is part of your Report Spam script. Also, add your ISP's spam abuse email address to your Report Spam script. And, it may be helpful to add the Federal Trade Commissions spam abuse email address too (uce@ftc.gov).

Fifth ... there is no fifth!

=====

Microsoft Entourage includes a script Script menu symbol menu that enables you to quickly run a compiled AppleScript script for Entourage and, among other things, use these scripts in the battle against Spam!

By default, this menu includes several scripts that you can use to create a task, note, or other type of item from a message that you select. To run a script from the script menu, click the script.
If you have written additional scripts for Entourage, you can add menu items for them to the script menu. To do so, save the script as a compiled script by using a script editor program, such as Apple Script Editor. Then move or copy the compiled script file to the Entourage Script Menu Items folder in your Documents/Microsoft User Data folder. The script menu updates automatically when a file is added to this folder and the file is a compiled script file with an "osas" file type.
If you add a menu item for a script, you can also define a keyboard shortcut for running it from Entourage. To define a keyboard shortcut, open Finder and then append a backslash (\) followed by the appropriate modifiers to the script file name. The modifiers are:
• s for SHIFT
• o for OPTION
• m for z
• c for CONTROL
For example, \cf corresponds to the keyboard shortcut CONTROL+f. Similarly, \msf corresponds to z+SHIFT+F. If you do not specify a modifier, z is assumed. For example, \f corresponds to z+f.
It's important to note that Entourage does not check for conflicts between keyboard shortcuts that you define and keyboard shortcuts that are defined by Entourage. Therefore, if a conflict exists, the result of using the shortcut is undefined.
Note You cannot add menu items for AppleScript applets to the script menu. You can add menu items only for compiled scripts.
I use control-S for my Spam Report Script and control-B for my Bounce Spam Script!

Tips
• To help yourself organize your scripts, you can add submenus to the script menu. To do so, open Finder, add a subfolder to the Entourage Script Menu Items folder, and then add one or more compiled script files to the subfolder.
• To quickly open a script for editing in the program the script was created in, hold down OPTION and click the script on the script menu.

FOR AWESOME APPLESCRIPTS, PLEASE VISIT http://www.applescriptcentral.com/

=====

SEE NEXT THREAD POST FOR SAMPLE SCRIPTS!
 
Thanks to Allen Watson for providing the following AppleScript (http://homepage.mac.com/allenwatson/FileSharing.html)

Report Spam Script:

tell application "Microsoft Entourage"

-- get the currently selected message or messages
set selectedMessages to current messages

-- if there are no messages selected, warn the user and then quit

if selectedMessages is {} then
display dialog "Please select a message first and then run this script." with icon 1
return

end if

repeat with theMessage in selectedMessages

-- get the information from the message, and store it in variables

set theName to subject of theMessage

--This grabs the headers and content of the spam message

set msgSource to source of theMessage

--"spam" is a contact with addresses to forward spam to, such as uce@ftc.gov

--But you can type in any email address here, it doesn't have to be a contact.

--Change "spam" to your own email address for testing.

--I slightly modified the author's set spamreportaddress line by adding commas between multiple email address to permit multiple reports to be sent; just place a comma between each address.

set spamReportAddress to "uce@ftc.gov, submit.[your spamcop ID here]@spam.spamcop.net, abuse-junkmail@[your ISP]"

set newM to forward theMessage to spamReportAddress without opening window and html text

set spamReportNote to "This SPAM message was sent to me:


"
set the content of newM to (spamReportNote & msgSource)

set the subject of newM to ("FWD SPAM: " & theName)

--Don't forward the attachments
delete the attachments of newM

--Optional, if you want to see the SPAM report first before sending it
open newM

--Optional, Go Ahead and Send the SPAM report (uncomment this and comment out above line)
--send newM

--Or send it later instead of immediately:
--send newM with sending later

--Optional, Delete the original SPAM message(uncomment)
--delete theMessage
end repeat

end tell
 
Bounce Spam Script:

(*
Bouncer
Copyright 2001, Glenn L. Austin
All rights reserved worldwide.

Bounces mail to the sender in the following format:

>Subject: Returned mail: see transcript for details
>
> The original message was received at «smtpReceivedDate»
> from [«smtpHost»]
>
> ----- The following addresses had permanent fatal errors -----
> <«email address»>
> (reason: 550 5.1.1 <«email address»>... User unknown)
>
> ----- Transcript of session follows -----
> ... while talking to «smtpHost».:
>>>> RCPT To:<«email address»>
> <<< 550 5.1.1 <«email address»>... User unknown
> 550 5.1.1 <«email address»>... User unknown

Version History
--------------
1.0 Initial release
1.1 Add the ability to bounce messages to a specific domain with a specific account.
1.1.1 Fixed a location where I forgot to change gSendingAccount
1.1.2 Fixed some other stupid remaining bugs

*)

property gSendingAccounts : {}

on run
tell application "Microsoft Entourage" to set messageList to the current messages
set bounceList to {}
if the (count of messageList) is not 0 then
repeat with i from 1 to the number of items in the messageList
set bounceList to bounceList & {ProcessMessage(item i of messageList)}
end repeat
else
display dialog "Please select messages for processing." buttons {"OK"} default button 1
end if
if bounceList is not {} then
tell application "Microsoft Entourage"
try
display dialog "Send bounce messages now?"
if button returned of result is "OK" then
try
send bounceList
repeat until connection in progress is false
delay 1
end repeat
on error the error_message
display dialog the error_message
end try

set sendCount to 0
repeat with j from 1 to the number of items in bounceList
if delivery status of item j of bounceList is sent then
set sendCount to sendCount + 1
end if
end repeat

if sendCount is equal to number of items in bounceList then
display dialog "Move original and bounce messages to Trash?"
if button returned of result is "OK" then
set deleteNow to ((button returned of (display dialog "Empty Deleted Items?")) is "OK")
repeat with k from 1 to the number of items in messageList
delete item k of messageList
if deleteNow then
delete item k of messageList
end if
end repeat

repeat with l from 1 to the number of items in bounceList
delete item l of bounceList
if deleteNow then
delete item l of bounceList
end if
end repeat
end if
else
display dialog "Sorry, only " & sendCount & " of " & number of items in bounceList & ¬
" bounce messages were sent." & return & return & ¬
"Please reconnect to the Internet and resend the bounce messages manually." buttons {"OK"} default button 1
end if
end if

on error the error_message
--display dialog the error_message
end try
end tell
end if
end run

on ProcessMessage(aMessage)
tell application "Microsoft Entourage" to set {msgSender, msgAccount, msgHeader} ¬
to {address of sender, account, headers} of aMessage

-- parse the headers into an array of entries
set msgHeaders to {}
repeat while msgHeader is not ""
if first character of msgHeader <= " " then
set lastItem to number of items in msgHeaders
repeat while first character of msgHeader <= " "
set msgHeader to characters 2 through -1 of msgHeader as string
end repeat
set eolOffset to offset of "
" in msgHeader
if (eolOffset > 1) then
set entryValue to characters 1 through (eolOffset - 1) of msgHeader as string
else
set entryValue to ""
end if
if length of msgHeader > eolOffset + 1 then
set msgHeader to characters (eolOffset + 1) through -1 of msgHeader as string
else
set msgHeader to ""
end if
set «class CGIv» of item lastItem of msgHeaders to («class CGIv» of item lastItem of msgHeaders) & " " & entryValue
else
set colonOffset to offset of ":" in msgHeader
set entryName to characters 1 through (colonOffset - 1) of msgHeader as string
set msgHeader to characters (colonOffset + 1) through -1 of msgHeader as string
repeat while msgHeader is not "" and first character of msgHeader is " "
set msgHeader to characters 2 through -1 of msgHeader as string
end repeat
set eolOffset to offset of "
" in msgHeader
if (eolOffset > 1) then
set entryValue to characters 1 through (eolOffset - 1) of msgHeader as string
else
set entryValue to ""
end if
if length of msgHeader > eolOffset + 1 then
set msgHeader to characters (eolOffset + 1) through -1 of msgHeader as string
else
set msgHeader to ""
end if
set msgHeaders to msgHeaders & {{name:entryName, «class CGIv»:entryValue}}
end if
end repeat

set msgDate to ""
set msgAddress to ""
repeat with i from 1 to number of items in msgHeaders
name of item i of msgHeaders
if name of item i of msgHeaders is "Received" then
set receivedLine to «class CGIv» of item i of msgHeaders
-- get the last date from the first "Received" line
if msgDate is "" then
set msgDateOffset to offset of ";" in receivedLine
if msgDateOffset is not 0 then
set msgDate to characters (msgDateOffset + 1) through -1 of receivedLine as string
repeat while first character of msgDate is " "
set msgDate to characters 2 through -1 of msgDate as string
end repeat
end if
end if

-- look for actual user in Received lines
set userOffset to offset of " for " in receivedLine
if userOffset is not 0 then
set userAddress to characters (userOffset + 5) through -1 of receivedLine as string
if first character of userAddress is "<" then
set userAddress to characters 2 through -1 of userAddress as string
set userOffset to offset of ">" in userAddress
else
repeat with userOffset from 1 to the number of characters in userAddress
if character userOffset of userAddress <= " " then
exit repeat
end if
end repeat
end if
set userAddress to characters 1 through (userOffset - 1) of userAddress as string

if not (userAddress contains "@localhost") then
set msgAddress to userAddress
end if
end if
end if

if msgDate is not "" and msgAddress is not "" then
exit repeat
end if
end repeat

if msgAddress is "" then
tell application "Microsoft Entourage" to set msgAddress to email address of account of aMessage
end if

if (msgDate is not "" and msgAddress is not "") then
set serverOffset to offset of "@" in msgAddress
set msgServer to characters (serverOffset + 1) through -1 of msgAddress as string
set msgSendAccount to GetSendingAccount(msgServer)
set msgContent to ¬
"The original message was received at " & msgDate & " from " & msgServer & "

THE REST OF THE SCRIPT IS CONTINUED IN THE NEXT POST
 
Bounce Spam Script (cont.):

----- The following addresses had permanent fatal errors -----
<" & msgAddress & ">
(reason: 550 5.1.1 <" & msgAddress & ">... User unknown)

----- Transcript of session follows -----
... while talking to " & msgServer & ".:
>>> RCPT To:<" & msgAddress & ">
<<< 550 5.1.1 <" & msgAddress & ">... User unknown
550 5.1.1 <" & msgAddress & ">... User unknown"
set msgSubject to "Returned mail: see transcript for details"
tell application "Microsoft Entourage"
set bounceMsg to make outgoing message with properties ¬
{recipient:msgSender, subject:msgSubject, account:msgSendAccount, content:msgContent}
send bounceMsg with sending later
end tell
end if
return bounceMsg
end ProcessMessage

on GetSendingAccount(inServer)
set sendingAccount to {}

repeat with i from 1 to number of items in gSendingAccounts
if sendName of item i of gSendingAccounts is inServer then
tell application "Microsoft Entourage" to set sendingAccount to {sendAccount of item i of gSendingAccounts}
exit repeat
end if
end repeat

if sendingAccount is not {} then
try
tell application "Microsoft Entourage" to ID of (item 1 of sendingAccount)
on error
set sendingAccount to {}
end try
end if

if sendingAccount is {} then
set accounts to {}
set accountStrings to {}
try
tell application "Microsoft Entourage" to set popAccountNames to name of POP accounts
on error
set popAccountNames to {}
end try
try
tell application "Microsoft Entourage" to set imapAccountNames to name of IMAP accounts
on error
set imapAccountNames to {}
end try
try
tell application "Microsoft Entourage" to set hotmailAccountNames to name of Hotmail accounts
on error
set hotmailAccountNames to {}
end try
tell application "Microsoft Entourage"
repeat with i from 1 to number of items in popAccountNames
set accounts to accounts & {POP account (item i of popAccountNames)}
set accountStrings to accountStrings & {item i of popAccountNames & " (POP)"}
end repeat
repeat with i from 1 to number of items in imapAccountNames
set accounts to accounts & {IMAP account (item i of imapAccountNames)}
set accountStrings to accountStrings & {item i of imapAccountNames & " (IMAP)"}
end repeat
repeat with i from 1 to number of items in hotmailAccountNames
set accounts to accounts & {Hotmail account (item i of hotmailAccountNames)}
set accountStrings to accountStrings & {item i of hotmailAccountNames & " (Hotmail)"}
end repeat
set accountSelectedString to choose from list accountStrings with prompt ¬
"Send bounces for " & inServer & " from which account:" without multiple selections allowed and empty selection allowed
try
set accountSelectedString to item 1 of accountSelectedString
on error
error number -128 -- user cancelled
end try
repeat with i from 1 to number of items in accountStrings
if accountSelectedString is item i of accountStrings then
set sendingAccount to {item i of accounts}
set gSendingAccounts to gSendingAccounts & {{sendName:inServer, sendAccount:(item i of accounts)}}
exit repeat
end if
end repeat
end tell
end if

return item 1 of sendingAccount
end GetSendingAccount

PLEASE RETAIN ALL COPYRIGHT NOTICES WITH YOUR SCRIPT TO HONOR THE AUTHOR. IF YOU FORWARD YOUR SCRIPT TO ANYONE ELSE PLEASE MAKE SURE THAT IT HAS THE FULL COPYRIGHT NOTICE ON IT PRECISELY AS DISPLAYED HEREIN. THANK YOU.
 
That link provides useful information BUT it is not dispositive. Not all Spammers use successful avoidance methodology; some are spammers but not fraudulent -- in other words, it is still unsolicited junk mail fitting the definition of SPAM but is not false header info, etc. Thus, these semi-legitimate emails THAT ARE STILL UNSOLICITED AND UNDESIRED COMMERCIAL SPAM (Get Rich Schemes, etc.) can still be fooled by the bounce command.

Also, many of these idiots provide REAL info because they HAVE TO -- if they are trying to sell you something then they have to provide you with real contact info ... how else do you contact them??

It is the XXX Porno Illegal Sites that typically use non-functioning and/or illigitimate email headers that cannot be bounced. But you can STILL report this SPAM to SpamCop.net and to the FTC.

The point is not to give up. Simply deleting the crap alone is not enough. If your local ISP (or the sender's true ISP) gathers enough complaints then they can file a Federal Cause of Action against the Spammers. It is not economical for a user to do so but it IS economical for an ISP because SPAM takes up resources and bandwidth on their pipline and servers for thousands (if not millions) of users!

FIGHT SPAM. If you are a Spammer you are a corrupt, amoral individual! Do not believe your self-talk that it is "just business" or "everyone is doing it." You are a leech on society and are no better than a petty thief!

Karma will eventually catch up to you!
 
I too hate spam. It typically takes an hour (give or take) for me to go through my email everyday ( I have to make sure it is spam before I delete it due to the fact that I get email from individuals I do not know often and many of these emails are from foreign, and often spam-ridden, corners of the world - scripts are problematic for me). Sure my rules usually catch the "I want to xxxxxxx your xxxxxxx with a xxxxxx" or "watch these teen babes xxxxxxxx", you get the idea, but my main problem is those get rich quick schemes/sales pitches that mimic real business or legal correspondence. It seems they target me specifically! Ugh.

The main reason for posting that link was the time issue he raises. Anyone with half a brain and the inclination can see that your message was bounced 3 or 4 hours after it should have been and that the actual message (data) was sent successfully. Getting your ISP or mailhost to bounce automatically is key. It always ticks me off that Earthlink (my ISP) touts its "Spaminator," yet at least 25-30% of my spam was forwarded from that account before I set my rules to del all mail from there.
 
Here's how i combat Junk e-mail
•use Entourage spam filter, which catches 95 out of 100 junk e-mails
•90% of my junk mal is through my ISP account, so I just delete it
•if it is to my domain name acocunt, then I keep the junk mail, and once a week or so (since I may only get 10 junkmails a week) add the e-mail adrees (if a good domain) or domain to my spam filter, and boom they are black listed.

the bad news, is a few ligit e-mails get put in the trash, since entourage thinks they are junk mail.

I would like to stop using my ISP account sometime in the future (of 7 years), but they do send me e-mails.

SO why does my ISP account get so much junk mail? but my mac.com and domain accounts get little to no junkmail (other then comdex selling my e-mail address)
 
Great idea! I never thought to try to send a fake bounce message before.

I do have one problem with the bounce script. when I go to check syntax it replies the following: (Expected ":" but found identifier)
This happens on the last line that I did post and errors on the "i" variable in that line. Am I doing anything wrong? I'm new to applescript as you can tell

repeat with i from 1 to number of items in accountStrings
if accountSelectedString is item i of accountStrings then
set sendingAccount to {item i of accounts}
set gSendingAccounts to gSendingAccounts & {{sendName:inServer, sendAccountitem i of accounts)}}
 
Originally posted by Rhino_G3
I do have one problem with the bounce script. when I go to check syntax it replies the following: (Expected ":" but found identifier).

Make sure that you have proper line-returns if you copied the script from my post and just pasted it into the Editor. If I get a chance (and you email me your email address) I can send you the script.
 
Is there any advantage to bouncing spam? Mostly when I bounce spam, with Mail.app's built in bounce feature, I get an email right back that the account has been closed. You have to catch the spam right away, so when I check my mail at work every morning, the spam that's come overnight no longer gets back to the spammer's real address when you bounce it.

I check my mail every 15 minutes automatically during the work day. At these times, I bounce spam, and generally do not get the undeliverable message back, however I don't see any decrease in the amount of spam that I get either. So, I don't see doing this having any effect.
 
Back
Top