Automate reporting spam to spamcop.net

Updated 05/31/2013

Reporting spam to SpamCop can get to be tiresome. The normal process is:

  1. Receive spam
  2. Copy the raw message
  3. Log into SpamCop.net
  4. Paste the message
  5. Wait for the verification message
  6. Mark the message as spam in Mail
  7. Delete the message
  8. Click the link in the verification message
  9. Wait for spamcop.net’s nag screen to go away
  10. Submit the spam report
  11. Delete the verification message from Mail

Luckily much of it can be automated with Mac Mail and some AppleScripting. The solution I’m posting boils it down to:

1. Receive spam
2. Fire a script via the applescript menu
9. Wait for SpamCop.net’s nag screen to go away
10. Submit the spam report

As you can see, 7 steps are handled automatically.

Instructions

The first thing you have to do is grab the scripts from github: SpamCop Deputy

Next set up an account at SpamCop.net. When you log in, set the expiration to 1 year.

Enable the AppleScript menu.

1) Open “AppleScript Editor.app”. It will either be in your Applications folder or Utilities folder.
2) Edit General preferences, and turn on “Show Script menu un menu bar”.
Now you’ll have an easy way to fire off the initial script. These items are only available when Mail is the front most application.

Set up a script to send SpamCop the raw source of the spam messages.

1) Create this folder if it does not exist: ~/Library/Scripts/Applications/Mail
2) Drop the attached “SpamCopNotify.scpt” into that folder.
3) Edit line 1 with your unique SpamCop email submission address.
This script will get the raw source of all messages selected in Mail and send them to SpamCop, mark the message as read, mark the message as spam, then delete the message.

Set up a script to handle the SpamCop verification email.

1) Drop the attached “SpamCopIn.scpt” file into ~/Library/Application Scripts/com.apple.mail .
This script will automatically ‘click’ the verification link and delete the verification email.

Add a mail rule to fire SpamCopIn.scpt when the verification email is received.

1) Create a new mail rule
2) If all of the following are met:
+ Received is less than 2 days old (that’s a spamcop rule)
+ From contains “[email protected]
+ Message content contains “http://www.spamcop.net/sc?id=”
3) Perform the following actions:
+ Run AppleScript “~/Library/Scripts/Applications/Mail/SpamCopIn.scpt”
+ Play Sound [any] (this is optional)
4) Do Not Apply when prompted to do so when you save.

Now we’re all ready to go.

Next time you get spam…
1) Select the message(s)
2) From the AppleScript menu, select “SpamCopNotify.scpt”
SpamCopNotify.scpt will get the raw source of all messages selected in Mail and send them to SpamCop.
The messages will be marked as read, marked as spam then deleted.
SpamCop will reply with a verification message(s) shortly.
Mail will evaluate the verification message(s) with it’s rules and launch the SpamCopIn.scpt script.
SpamCopIn.scpt will find the verification link and launch it in your default browser as a new window/tab.
The message will be marked as read then deleted.
3) When your browser opens the SpamCop site, wait for the nag screen to go away then press “Process Spam”.

Custom scrollbars in Adium – ‘Elegant Simple’ Message Style

Visually based on the “Pretty Simple” Message Style by Piotrek Marciniak, I’ve created a new breed of Adium Message Style – which boasts a completely custom scrollbar.

This message style is a working proof of concept. It is a prototype for the talented folks that create  wonderful message styles. I’m a developer, not an artist. I hope that others will use it as a spring board for rapid development of a whole new breed of message styles with custom scrollbars.

Since Adium Message Styles are really web pages, it only seemed right to mash up Prototype JS, LivePipe UI and Scriptaculous!

Features

  • Fade-in of messages
  • Auto smooth scrolling when new message is received
  • Custom styled scrollbar
  • Dynamic height scrollbar handle
  • Header and Footer objects of scrollbar handle
  • Auto-hiding and fading scrollbar (mouse in/out of window)
  • Mouse wheel support

[media id=11 width=600 height=470]

( View full size 800×600 MP4 3.7MB )

Go and get it!

Visual Code Editor 1.2.5

I’ve updated Visual Code Editor. Not so much an upgrade, but tested it out with SyntaxHighlighter Evolved 2.3.8 and WordPress 2.9.2.

SyntaxHighlighter Evolved fixes a lot of the problems that VCE also fixed (for SyntaxHighlighter Plus 1.x). But VCE still comes into play when you want to use tinyMCE (the post editor) in WordPress.

  • Adds `<pre>` & `<code>` to block format menu
  • Allows extra attributes for compatibility in some syntax highlighters (ie, `<pre lang=”php” line=’5′>`)
  • Unescape WP’s double escaping of & (not needed with SHE)
  • Allows iFrames in the post
  • Support for syntax highlighting in comments
  • Removes extra `<pre>` tags around SyntaxHighllighter Plus’s sourcecode blocks

I tested it out with SHE and they both play very well together. Although the fixes in VCE are no longer needed, it still adds some functionality to the Visual Editor. Since nothing broke, I’m not going to fix it (remove the fixes). This allows its continued use in other client side syntax highlighters.

Go get it –> http://wordpress.org/extend/plugins/visual-code-editor/

Also, I highly recommend SyntaxHighlighter Evolved.

CFup build 090624 – now on github

It’s been asked that I release the source of CFup. Initially I was not comfortable doing so as I threw it together as a test of concept. Certainly nt my best work! Feeling inspired I cleaned up some of the code – mostly just so the ajax routines don’t clash – and uploaded it to github. Now anyone can download it, try it out, and contribute. I’m excited to see what optimizations and cleanups can be done to it. So if you’re interested in kicking the tires or helping develop it, check it out on github: http://github.com/WebVeteran/CFup/

ColdFusion clips for Coda

I have made quite a few Clips in Coda to make development a little speedier. Hopefully you can get some use out of them too.

Coda Clips
Preview of Coda Clips - keep in mind the clips window only shows the first line of each clip.

Download the Clips here:
ColdFusion Coda Clips

CF TinyMCE 090612 – automatically handles multiple instance per page

I updated CF tinyMCE with a small nicety. It now automatically handles multiple instance per page. Previously, it would have to be invoked like so:

<cfoutput>
<tr>
	<td>
		#application.includes.tinymce(
			content=read.en,
			element="en",
			csswidth="444px",
			resizing=true,
			theme='advanced',
			theme_advanced_buttons1 = "bold,italic,underline,|,justifyleft,justifycenter,justifyright,justifyfull,|,formatselect,|,bullist,numlist,|,undo,redo,|,code,cleanup",
			theme_advanced_buttons2 = "",
			theme_advanced_buttons3 = ""

		)#
	</td>
	<td>
		#application.includes.tinymce(
			content=read.es,
			element="es",
			csswidth="444px",
			resizing=true,
			theme='advanced',
			loadbase='0',
			language='es',
			theme_advanced_buttons1 = "bold,italic,underline,|,justifyleft,justifycenter,justifyright,justifyfull,|,formatselect,|,bullist,numlist,|,undo,redo,|,code,cleanup",
			theme_advanced_buttons2 = "",
			theme_advanced_buttons3 = "",
			gecko_spellcheck = "false"
		)#
	</td>
</tr>
</cfoutput>

Notice the ‘loadbase=0’ argument on the second invocation. That told the previous version of CF TinyMCE to not all of TinyMCE again – just load the settings instead.

The new version automatically handles multiple instances and not loading TinyMCE all over again for subsequent invocations on the same page. Therefore, the new syntax example is:

<cfoutput>
<tr>
	<td>
		#application.includes.tinymce(
			VScope=Variables,
			content=read.en,
			element="en",
			csswidth="444px",
			resizing=true,
			theme='advanced',
			theme_advanced_buttons1 = "bold,italic,underline,|,justifyleft,justifycenter,justifyright,justifyfull,|,formatselect,|,bullist,numlist,|,undo,redo,|,code,cleanup",
			theme_advanced_buttons2 = "",
			theme_advanced_buttons3 = ""

		)#
	</td>
	<td>
		#application.includes.tinymce(
			VScope=Variables,
			content=read.es,
			element="es",
			csswidth="444px",
			resizing=true,
			theme='advanced',
			language='es',
			theme_advanced_buttons1 = "bold,italic,underline,|,justifyleft,justifycenter,justifyright,justifyfull,|,formatselect,|,bullist,numlist,|,undo,redo,|,code,cleanup",
			theme_advanced_buttons2 = "",
			theme_advanced_buttons3 = "",
			gecko_spellcheck = "false"
		)#
	</td>
</tr>
</cfoutput>

No more loadbase! The key is the argument “Vscope=Variables”. That lets CF pass the Variables scope back and forth between a page and a function. It is a required argument which I am not happy about. But since it’s value never changes it’s not so bad.

Because of this fundamental change, CF TinyMCE 090612 is not backwards compatible. If anyone knows how to pass the Variables scope back and forth between a page and a function, without an argument like I am here – please let me know!

You can download CF TinyMCE at github: http://github.com/WebVeteran/cf-tinymce/

ColdFusion function: create tinyMCE instances

As promised, I am releasing the CF function I use to display tinyMCE instances. It can handle multiple languages, multiple instances per page, and of course compression.

It’s somewhat basic right now. I set up defaults for most end-clients, meaning its easy to use and familiar feeling. I came to this configuration after working with clients for two years – listening to their complaints and slowly molding the defaults to what is here now.

The simplest incarnation is:

<cfoutput>
#application.formutils.tinymce(content=read.bio)#
</cfoutput>

This assumes you cached the CFC into an application variable called ‘formutils’, and a query named ‘read’ with a field called ‘bio’. That will generate the base code (put into the htmlhead by default), create the textarea named ‘content’, set up modified defaults for tinyMCE and then display it.

But you can get fancier:

<cfoutput>
#session.utils.tinymce(
	content=read.rightcolumn,
	element="rightcolumn",
	cssfile="/includes/css/common.css,/includes/css/tiny_dyn.cfm?csswidth=210px",
	resizing=false,
	loadbase=0
)#
</cfoutput>

That one will create a textarea with name and id of ‘rightcolumn’. It will also use specific css files. If you notice that last css file is a cfm page that dynamically creates the width of the page. This is awesome for giving the editor a real-time view of their page. Then it turns resizing off. Finally, with loadbase=0, the base of tinyMCE will not be loaded (this example is for a secondary tinyMCE instance in the same page).

Most of the defaults can be overridden with arguments as demonstrated above. However this function is not all-encompassing of tinyMCE’s many attributes. If you need more customizability, feel free to fork the git project, or simply ask me for the attribute you need inserted.

You can get this CF function directly from github: http://github.com/WebVeteran/cf-tinymce

Bonus example

A multilingual coldfusion application using tinymce for translations. One instance is the english, the other is spanish. Both use a very simple editor. It’s actually the advanced editor configured to mock the simple editor, but with a few extra buttons.

<cfoutput>
<tr>
	<td>
		#application.includes.tinymce(
			content=read.en,
			element="en",
			csswidth="444px",
			resizing=true,
			theme='advanced',
			theme_advanced_buttons1 = "bold,italic,underline,|,justifyleft,justifycenter,justifyright,justifyfull,|,formatselect,|,bullist,numlist,|,undo,redo,|,code,cleanup",
			theme_advanced_buttons2 = "",
			theme_advanced_buttons3 = ""

		)#
	</td>
	<td>
		#application.includes.tinymce(
			content=read.es,
			element="es",
			csswidth="444px",
			resizing=true,
			theme='advanced',
			loadbase='0',
			language='es',
			theme_advanced_buttons1 = "bold,italic,underline,|,justifyleft,justifycenter,justifyright,justifyfull,|,formatselect,|,bullist,numlist,|,undo,redo,|,code,cleanup",
			theme_advanced_buttons2 = "",
			theme_advanced_buttons3 = "",
			gecko_spellcheck = "false"
		)#
	</td>
</tr>
</cfoutput>

Output is:

two tinymce instances
two tinymce instances - click to view larger