Submit Hint Search The Forums LinksStatsPollsHeadlinesRSS
14,000 hints and counting!

An AppleScript to forward spam to the FTC via Mail Apps
The following appears on the FTC's Spam page:
Do you receive lots of junk email messages from people you don't know? It's no surprise if you do. As more people use email, marketers are increasingly using email messages to pitch their products and services. Some consumers find unsolicited commercial email - also known as "spam" - annoying and time consuming; others have lost money to bogus offers that arrived in their email in-box.

This website has information about the Federal Trade Commission's recent law enforcement actions against deceptive commercial email and spammers' responsibilities under the CAN-SPAM law. In the "For Consumers" section, you'll find tips on how to reduce the amount of spam email in your in-box.

If you get spam email that you think is deceptive, forward it to spam@uce.gov. The FTC uses the spam stored in this database to pursue law enforcement actions against people who send deceptive email.
If you'd like to help them out by forwarding them a selection of deceptive spam, read on for an AppleScript to do just that...

Here's the AppleScript; open up Script Editor (in /Applications/AppleScript), and paste in this code:
tell application "Mail"
  set theMessages to the selection
  repeat with thisMessage in theMessages
    set newMessage to make new outgoing message at end of outgoing messages
    tell newMessage
      set content to thisMessage's source
      set subject to thisMessage's subject
      make new to recipient with properties {address:"spam@uce.gov"}
    end tell
    send newMessage
    set read status of thisMessage to true
  end repeat
end tell
Then save the script to your user's Library -> Scripts -> Applications -> Mail folder (create the last one if necessary), and call it spam_uce_gov.scpt. Next, if you haven't done so yet, open up AppleScript Utility (in the same directory as Script Editor). Check 'Show Script Menu in menu bar' and 'Show Library scripts' and 'top.'

Now open up Mail.app, and navigate to your junk mail folder. Highlight every piece of deceptive junk that you want to report to the FTC, and then go to the AppleScript menu bar icon, and select spam_uce_gov.scpt. Off they go!

[robg adds: This worked for me, though I had to first hit Command-Option-U to display the raw source, since I have Mail set to force plain text, which makes most HTML-base spam look basically empty.]
    •    
  • Currently 3.20 / 5
  You rated: 1 / 5 (5 votes cast)
 
[21,722 views]  

An AppleScript to forward spam to the FTC via Mail | 40 comments | Create New Account
Click here to return to the 'An AppleScript to forward spam to the FTC via Mail' hint
The following comments are owned by whoever posted them. This site is not responsible for what they say.
An AppleScript to forward spam to the FTC via Mail
Authored by: jackb79 on Feb 23, '06 08:22:53AM

Wouldn't it be eaiser to set up a rule un mail saying

if mail is junk

then forward to spam@uce.gov

why create an applescript? the tools are within mail itself



[ Reply to This | # ]
An AppleScript to forward spam to the FTC via Mail
Authored by: spidermann on Feb 23, '06 08:28:19AM

did that years ago and has worked fine every time. no need for the long script and extra steps. Mail just does it.



[ Reply to This | # ]
An AppleScript to forward spam to the FTC via Mail
Authored by: spidermann on Feb 23, '06 08:29:35AM

forgot this part...

the difference on mine is that I set it to redirect, so it appears that the spammers are spamming the FTC.

;)



[ Reply to This | # ]
An AppleScript to forward spam to the FTC via Mail
Authored by: hirandy on Feb 23, '06 10:33:21AM

One problem with using Mail rule tools is that there's no subjective selectivity -- unless your junk filters are perfect, you may cause problems for somebody.

I forward most junk to another address for a different reason (not the FCC) by occasionally selecting what I want and moving them to a folder with forwarding actions.



[ Reply to This | # ]
An AppleScript to forward spam to the FTC via Mail
Authored by: blgrace on Apr 10, '06 07:41:14PM

How do you set up a folder in mail with forwarding actions?



[ Reply to This | # ]
An AppleScript to forward spam to the FTC via Mail
Authored by: TigerKR on Feb 27, '06 10:39:17AM

Some of the mail that ends up in my junk folder is not-junk. Some of the mail that ends up in my InBox is junk. While Mail.app is usually 99% accurate, it does have false positives and false negatives. Therefore, I don't want to send not-spam to the 'spam@gov' address.



[ Reply to This | # ]
An AppleScript to forward spam to the FTC via Mail
Authored by: billbarstad on Feb 23, '06 08:23:40AM

How about one for Entourage?



[ Reply to This | # ]
An AppleScript to forward spam to the FTC via Mail
Authored by: c.ho on Feb 23, '06 10:15:35PM

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 theSubject to subject of theMessage
		set theContent to source of theMessage
		
		-- create a new email with the information from the message
		set newMessage to make new outgoing message with properties {subject:theSubject, content:theContent, address:"spam@uce.gov"}
		
		send newMessage
		set read status of theMessage to read
	end repeat
end tell


[ Reply to This | # ]
An AppleScript to forward spam to the FTC via Mail
Authored by: tj2001 on Feb 23, '06 02:26:24PM

I got a nice command you can also throw in there!
After is sends it how about it deletes it also?? Thanks for the script.

---
--- www.macdynamix.com ---
:: Super Me I Am ::



[ Reply to This | # ]
An AppleScript to forward spam to the FTC via Mail
Authored by: tj2001 on Feb 23, '06 02:33:07PM
Okay I think I properly implemented the "delete" feature I was asking about:
tell application "Mail"
	set theMessages to the selection
	repeat with thisMessage in theMessages
		set newMessage to make new outgoing message at end of outgoing messages
		tell newMessage
			set content to thisMessage's source
			set subject to thisMessage's subject
			make new to recipient with properties {address:"spam@uce.gov"}
		end tell
		send newMessage
		set read status of thisMessage to true
		delete thisMessage
	end repeat
end tell
Also, you could probably remove the line:
set read status of thisMessage to true
Is this right or is there a better method? I'm not a keen Applescriptor this was just from opening the "Library" for Mail and adding that function :)

---
--- www.macdynamix.com ---
:: Super Me I Am ::

[ Reply to This | # ]

An AppleScript to forward spam to the FTC via Mail
Authored by: gabba1 on Feb 23, '06 04:13:43PM

How about a script that is even MORE useful?

How about a script that automatically backtracks EVERY incoming eMail to check to see if it is from a REAL eMail address. If it is, it lets the eMail through... if it is not and is a auto-generated address from a SPAM-bot... it automatically gets rejected and never even shows up in your inbox.

That would be much more helpful to me!



[ Reply to This | # ]
ineffective
Authored by: sjk on Feb 23, '06 07:59:12PM

Briefly, the two main problems with your suggestion:

• There's no consistently accurate, reliable, and efficient way to verify that sender addresses on mail you receive are "real".
• Spam typically uses forged, but "real" (valid, RFC-compliant), addresses.

There are plenty of tools for detecting and filtering suspected spam (using different techniques) before it ever reaches your inbox. Even Apple Mail's default junk filter can often do a fairly decent job.



[ Reply to This | # ]
An AppleScript to forward spam to the FTC via Mail
Authored by: TigerKR on Feb 27, '06 11:06:15AM

Try this hint:

"An AppleScript rule to check Mail against blackhole lists"

http://www.macosxhints.com/article.php?story=20030523090008320



[ Reply to This | # ]
RBL effectiveness
Authored by: sjk on Feb 27, '06 06:58:44PM

Regardless of arguments and politics about RBL, it's working quite effectively with server-side filtering for identifying most spam I receive. Messages are tagged with X-RBL-Warning headers and get dumped directly to a junk mailbox where I've rarely found false positives. And Apple Mail's junk filter has been reasonably effective with handling the small remainder of non-RBL spam.

I've been more satisfied with that server/client combination than when all spam filtering was handled on the server. It's turned out to be easier junking a couple false negatives a day than it used to be dredging through the junkbox looking for significantly more false positives that mistakenly ended up there. I'm still undecided whether it's worth using JunkMatcher to do a more thorough job catching what Mail's junk filter misses.



[ Reply to This | # ]
An AppleScript to forward spam to the FTC via Mail
Authored by: TigerKR on Feb 27, '06 10:30:08AM

I have Mail automatically delete email from "Junk" and "Trash" after one day (as insurance). Though, you can set it to delete on quit also.



[ Reply to This | # ]
An AppleScript to forward spam to the FTC via Mail
Authored by: renderhead on Feb 24, '06 05:32:56AM
I adapted this to replace my "Erase Junk Mail" command. Save this script in the location of your choice, then use Butler or Quicksilver or something to map a keyboard shortcut. I just use the script menu, personally.

tell application "Mail"
	set theMailboxes to mailboxes in junk mailbox
	repeat with thisMailbox in theMailboxes
		set theMessages to messages in thisMailbox
		repeat with thisMessage in theMessages
			set newMessage to make new outgoing message at end of outgoing messages
			tell newMessage
				set content to thisMessage's source
				set subject to thisMessage's subject
				make new to recipient with properties {address:"spam@uce.gov"}
			end tell
			send newMessage
			delete thisMessage
		end repeat
	end repeat
end tell
This works if you have multiple accounts within mail, since your Junk mailbox contains a mailbox for each account within it. If you only have one account, and consequently have no sub-folders within Junk, this would probably work as well (though I haven't tested it):

tell application "Mail"
	set theMailboxes to messages in junk mailbox
	repeat with thisMessage in theMessages
		set newMessage to make new outgoing message at end of outgoing messages
		tell newMessage
			set content to thisMessage's source
			set subject to thisMessage's subject
			make new to recipient with properties {address:"spam@uce.gov"}
		end tell
		send newMessage
		delete thisMessage
	end repeat
end tell


[ Reply to This | # ]
An AppleScript to forward spam to the FTC via Mail
Authored by: tjpeistr on Mar 27, '06 04:17:38PM

The script works great (I modified b/c I also use the BlueFrog service, so I email to both FTC and to BlueFrog) -- however, I haven't been able to modify the script to delete the "sent" message. Since the 90% plus of my email is spam (200+ daily), my "sent" folders are filled up with FTC/BlueFrog spam forwards. Any suggestions?



[ Reply to This | # ]
An AppleScript to forward spam to the FTC via Mail
Authored by: gabba1 on Feb 24, '06 08:33:47AM

Not true.

I have an acquaintance who created a script on my Windoze machine to send a reply eMail to the sender, forcing them to confirm their address prior to the eMail even coming through to me.

It worked like a charm, and stopped the THOUSANDS of spams I was getting a week on my corporate account.

I KNOW this can be done on a Mac. I just don't know how to do it myself... or I would! And then, I would give it away to ANYONE that wanted to stop these worthless jerks who continually assault us indiscriminately with their GARBAGE!



[ Reply to This | # ]
An AppleScript to forward spam to the FTC via Mail
Authored by: sjk on Feb 24, '06 08:35:34PM

(I'm guessing you were responding out-of-thread to me)

Sounds like you're looking for a challenge-response solution, which requires interaction from senders to validate themselves to recipients. I thought you wanted something without that extra level of intervention.

There's more than enough information (on the web) about challenge-response and other anti-spam tactics if you want to take time to educate yourself about them. Also, you might consider using a mail provider offering server-side anti-spam support that fits your needs.



[ Reply to This | # ]
An AppleScript to forward spam to the FTC via Mail
Authored by: billbarstad on Feb 24, '06 09:43:58AM

I added this script to /Users/bill/Documents/Microsoft User Data/Entourage Script Menu Items, after exporting it from Script Editor , selected the contents of my Junk E-Mail in Entourage and ran the script. Perfect! Bravo!



[ Reply to This | # ]
An AppleScript to forward spam to the FTC via Mail
Authored by: webgodjj on Feb 24, '06 11:24:12AM

I'm not sure how to do this.. however, wouldn't it be useful to send the message with the full headers?



[ Reply to This | # ]
forwarding with full headers
Authored by: sjk on Feb 24, '06 09:26:56PM

Yep, it's best to forward with full headers when reporting spam. I still haven't found a satisfying way to do that with Apple Mail ...

While using Mulberry (before its company's bankruptcy announcement), I'd forward messages as attachments whenever I wanted to guarantee the entire original content (including all headers) would be preserved. That also kept any additional annotations I'd make clearly distinct from the forwarded message. Unfortunately Apple Mail doesn't have a "forward as attachment" function, although recipients aren't always attachment-friendly.

I'm surprised no one's written a Mail plugin(?) for that since it's very useful in certain situations, like manually reporting fraudulent messages. It's yet another of Mulberry's many cool "power" features I occasionally miss although the transition to Mail hasn't been as painful as I'd anticipated.



[ Reply to This | # ]
forwarding with full headers
Authored by: tmneast on Feb 26, '06 01:09:59PM

"Yep, it's best to forward with full headers when reporting spam. I still haven't found a satisfying way to do that with Apple Mail ..."

Until now I would first press Cmd-Opt-U to display the message in raw form, select all and copy, then Cmd-Shift-F to forward, paste to insert the raw message (which includes full original headers), address and send it.

So this thread was encouraging, but when I use the script above, it doesn't get the raw message source. However, I just now discovered an existing script I'd overlooked before: 'Get Source of Selected Messages' (/Library/Scripts/Mail Scripts/Scripts Menu/Get Source of Selected Message.scpt) which apparently came with Panther.

It opens a new message window, plops in the raw source, fills in the subject line ... everything but address the message and send it. I'd imagine that a snippet of the Apple code could be spliced into the original poster's script to make the "ideal" one.

I'm not much of a scripter, but if someone savvy doesn't whip it up in five minutes, I'll stumble through it myself after I've finished some more pressing chores.



[ Reply to This | # ]
forwarding with full headers (results changed!)
Authored by: tmneast on Feb 26, '06 03:21:26PM

Hmm ... I started experimenting with combining the scripts and had a pretty good version going. At one point I reran the original script at the top of this thread. Suddenly it, too, copied the raw source. I don't understand why it works now when it didn't work earlier.

Are others seeing this script not produce raw source (including original headers) or not?

Meantime, I'm going to call it a day and apologize for wasting bandwidth. :^)



[ Reply to This | # ]
forwarding with full headers (results changed!)
Authored by: sjk on Feb 26, '06 11:21:00PM

Thanks for investigating and figuring out this much.

I've manually forwarded raw messages a few times as you described. I'm sure there's some way to automatically encapsulate them as attachments instead. I'll send a request to the Mail Scripts developer since it seems like something he might consider writing and including with that package.



[ Reply to This | # ]
forwarding with full headers (results changed!)
Authored by: tmneast on Mar 02, '06 04:10:36AM
I'm sure there's some way to automatically encapsulate them as attachments instead.

That would be preferable. Thanks for checking with the developer.

Meantime, to clarify my results, the original script above does indeed include full raw content of the spam mail (including original headers) within the body of the message forwarded to the FTC, with no manual intervention on my part. (I don't have to manually choose to display raw format.) I don't know why my first test of the script didn't do that, but it has worked properly since, as is.

[ Reply to This | # ]

Found an AppleScript to forward as attachments
Authored by: tmneast on Mar 09, '07 04:24:24PM
I just came across a method to forward mail as attachments, over on the SpamCop forums: <http://forum.spamcop.net/forums/index.php?showtopic=7886>;

It creates files from the spam messages, then attaches those files to a new outgoing message. I imagine some sharp people here can build on this to customize the solution, and maybe offer suggestions to improve it.


[ Reply to This | # ]
An AppleScript to forward spam to the FTC via Mail
Authored by: TigerKR on Feb 27, '06 10:36:03AM

It appears that the full headers are automatically sent with the original script. The full headers are included in the "content" section of the email.



[ Reply to This | # ]
An AppleScript to forward spam to the FTC via Mail
Authored by: sjk on Feb 27, '06 07:16:27PM

I just noticed robg's footnote to your original hint says "though I had to first hit Command-Option-U to display the raw source". I wonder if that's why tmneast noticed different results with it during his "forwarding with full headers" testing.

PS: Maybe more detailed discussion (if any) belongs in the forum? It's awkward following the different topic subthreads here.



[ Reply to This | # ]
An AppleScript to forward spam to the FTC via Mail
Authored by: tmneast on Mar 02, '06 04:30:55AM

I don't know why it didn't work the first time, but it has worked properly ever since. The full raw version of the spam e-mail is sent in the body of the forwarded mail. (I'm using Mail 1.3.11 (v622) under OS X 10.3.9, in case that matters.)

If you change the mailto address to your own, you can see exactly what the FTC will see. It appears the contents would be identical to what an attachment would contain.

I think I'll change the script so the subject line of the forwarded message begins with "Fwd: " to make it clearer.



[ Reply to This | # ]
An AppleScript to forward spam to the FTC via Mail
Authored by: tinker on Feb 24, '06 06:59:29PM

So, don't get me wrong, I hate spam as much as the next guy (unsolicited plug: SpamSieve is the best $25 I've ever spent!!), but if everyone floods the FTC with massive quantities of spam, won't the FTC become completely bogged down and unable to do anything about it?



[ Reply to This | # ]
An AppleScript to forward spam to the FTC via Mail
Authored by: TigerKR on Feb 27, '06 10:45:15AM

"If you get spam email that you think is deceptive, forward it to spam@uce.gov. The FTC uses the spam stored in this database to pursue law enforcement actions against people who send deceptive email."

If the government can really help to get rid of spam, and they're asking for me to forward to them all of my spam, then by golly, I'm going to do it.

I would think that the federal government and state governments would want people to stagger their tax returns throughout the year, because I would think that if everyone sends their forms in the same few days every year, that they would be overwhelmed and not be able to process the data in a timely fashion.

Yet somehow, the government finds a way.

I guess the moral is that one shouldn't underestimate the size of the government.



[ Reply to This | # ]
[OT] government ways
Authored by: sjk on Feb 27, '06 07:22:18PM

And a trip to the DMV may give you reasons not to underestimate certain things about the government. ;-)



[ Reply to This | # ]
An AppleScript to forward spam to the FTC via Mail
Authored by: tinker on Feb 28, '06 05:54:45AM

True... but note the part of the quote that asks for spam "that you think is deceptive." I don't know about you, but I'd say that less than 10% of my spam is actually deceptive; most of it is selling something like meds or hair loss treatment or, ah, enhanced masculinity. They might be "deceptive" in the sense that they don't work, but what they're offering, at least, is up front. I would think that "deceptive" e-mail is something more like the ubiquitous letter from Nigeria asking you to help the former wife of the deceased Minister of Finance move his money out of an account and offering you obscene quantities of money in exchange for your assistance. If the FTC is really looking for those sorts of e-mails and not the masculine enhancement / pharmaceuticals kind, we wouldn't be doing them any favors by auto-flooding them with tons of the latter. Is my point.



[ Reply to This | # ]
An AppleScript to forward spam to the FTC via Mail
Authored by: Anonymous on Jul 31, '06 01:36:59PM

Most spam is sent from relays. These are often computers taken over by "kittens"-type viruses (you know, the one with the cute Powerpoint slideshow and the not-so-cute payload). So by forwarding spam to the FTC, or KnujOn or whoever else takes on the responsibility, you're also helping to cut the number of zombified Windows machines, and ultimately, cleaning up the Internet of unnecessary bandwidth usage. When one of the most successful anti-spam efforts, Blue Frog, went down, something like 90% of Internet traffic for the following days was spam.

I'm trying to tweak this script to send raw source to KnujOn. I'll post again if I'm successful.



[ Reply to This | # ]
An AppleScript to forward spam to the FTC via Mail
Authored by: SFScott on May 29, '06 09:31:08PM
Inspired by this script, I made one that is similar, but automatically forwards the
raw source and full headers (without any extra steps from you), plus then it
deleted the messages. I set this up to forward to .Mac's spam reporting address,
too, but you could delete that part. Download from:

http://homepage.mac.com/scmurray/reportspam/

[ Reply to This | # ]
An AppleScript to forward spam to the FTC via Mail
Authored by: Anonymous on Jul 31, '06 01:56:16PM
Here's my tweaked version. It adds a couple of features:
1. shows the message window of each message while it's been sent
2. tags "Fwd: " to the front of the subject
3. updates "was forwarded" and "junk mail" status
All it doesn't do is delete the messages and empty the trash. I figured it was best not to do those last two actions, just in case.


(* Cf. http://www.macosxhints.com/article.php?story=20060219014940761 *)
(* Richie Smit 31st July 2006 *)
set theSpamAuthority to "spam@uce.gov"
(* You might want to try KnujOn, www.knujon.com -- you need to be added to their whitelist first, so read their web pages *)

tell application "Mail"
set theMessages to the selection
repeat with thisMessage in theMessages
set newMessage to make new outgoing message at end of outgoing messages
tell newMessage
set visible to true (* comment out whole line to stop 'blinking' windows *)
set content to thisMessage's source
set subject to "Fwd: " & thisMessage's subject
make new to recipient with properties {address:theSpamAuthority}
end tell
send newMessage
set read status of thisMessage to true
set was forwarded of thisMessage to true
set junk mail status of thisMessage to true
end repeat
end tell

--
Rich

[ Reply to This | # ]
An AppleScript to forward spam to the FTC via Mail
Authored by: macdesktops on Feb 17, '09 01:23:08PM

This script worked beautifully under 10.4.11. Unfortunately, I upgraded to 10.5.6 last week and now Mail keeps undeleting my junk messages so they get resent the next time I run the script. That is to say that when I run the script, each message gets forwarded appropriately and moved to the Trash. But when I look in Junk after the script completes, the messages reload into Junk.

Has anyone found an AppleScript command to Mailbox>Erase Junk Mail or even to Mailbox>Erase Deleted Messages? I've looked but don't see one.

I tried adding delete messages in trash mailbox with junk mail status to the end of the script, but similar behavior occurs there. The message count in Trash goes down, but when I look in Trash, the messages reappear.



[ Reply to This | # ]
An AppleScript to forward spam to the FTC via Mail
Authored by: pkazmercyk on Aug 13, '09 10:01:49AM

I'm using a modified version of this script to forward spam to KNUJON. However, I'm wondering if there's a line of AppleScript code I can add to the script to remove my email signatures before the SPAM is forwarded, as some of my signatures contain URL links and I don't want them added to the mix. I'm good at a lot of things. AppleScript is not one of them, so any help will be greatly appreciated. Thanks!



[ Reply to This | # ]
An AppleScript to forward spam to the FTC via Mail
Authored by: tedw on Aug 13, '09 12:12:36PM
I haven't played with this script at all, but (theoretically) the way you would do this would be to add a line in the 'tell newMessage' block that says something like 'set message signature to false'. you'll have to play with the correct value: false might work, or 0, or none, or you may have to create a blank signature and set the message signature to that.

or if that proves to irritating, you can go the long way and create a new mail account just to send junkmail. set it up with the same email address as your main account, but so that it never checks for mail itself and never uses signatures. then in the script tell newMessage to use that account when it sends the email.

[ Reply to This | # ]