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”.

Change the priority of incoming mail (incl. Apple Mail)

… or, ‘the sender that cried emergency’.

Before I get into this article I’d first like to point out that this solution was not born out of anger, hostility, or any other negative vibe. It’s simply a usability and project management issue.

The Problem

We probably all have a sender or two that abuse the Priority setting of email messages. Perhaps they honestly think many of their message are actually very important. And that’s fine, priority can be objective. But it does cause a problem when checking email.

  • Just like The Boy Who Cried Wolf, a sender that sets too many messages to High Priority runs the risk of being ignored. That certainly is not good for the sender.
  • When other senders don’t use the priority setting, those messages get deferred. Not necessarily a good thing either.
  • Turning off the Priority column to cut down the noise makes legitimately important messages look normal priority.
  • Turning off the Priority column to cut down the noise also gets rid of the ‘Flagged’ designation.

So basically speaking, someone who abuses the priority setting can really muck up the works. And you can’t really them about it either.

Some email programs let you change the priority of incoming mail. I use Apple’s Mail as a mail client and it does not. I checked out scripts, plugins, even a workaround of moving the message to the Drafts mbox, change the priority, then move it back to the in mbox… which is not good because then it sets you as the sender. D’oh! I also tried editing the emlx file on the hard drive but that didn’t work, I guess because I’m using IMAP. What then can we do?

The Fix

What we need to do is target those few senders, reset the priority of their incoming messages, and add a visual clue that it was changed. All other senders should not be affected.

The fix is dependent on the mail server software. I’ll show how to do this with SmarterMail since that’s what I use. We’ll set up a Content Filter to look for high priority messages from a certain sender, and add an action to reset the message’s priority.

1) Click the Settings button, expand My Settings, expand Filtering, then click Content Filtering. Your list may be blank. Mine already has three set up. Just click New to get started.

2) Turn on ‘From specific address’ and ‘Flagged as high priority’ and then click Next.

3) Make sure ‘AND’ is selected. Enter email addresses for the target senders.
Click Next.

4) Now finally the magic. Give this filter a Name. Turn on ‘Add Header’ and enter in whichever header name/value your email program listens to. For priority, Apple Mail uses the mail header “X-Priority”.  That is what I set to 0 (zero). Other mail clients use “Importance” and “X-MSMail-Priority”. Either of those you set to “Medium” instead of 0.
I also prefix the subject with an asterisk. That way I still know the sender thought this message was important, without gumming up everything else.
Click Save.

5) Send yourself a high priority test message. When it comes in, you should see that the Flag column is blank and there is now an asterisk in front of the Subject. When you see the asterisk, feel free to giggle like a school girl, ‘tee hee!’

Also take a look at the raw source. You’ll see that the the original X-Priority of 1 was overwritten with a zero.

Hooray, it works! =)

Want to read more?

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!

Making Apple’s DigitalColor Meter useful

DigitalColorMeter
I had a long time gripe about the DigitalColor Meter that ships with Mac OS X. It would be nice to use it for web development when you want to copy a color from an image to make text of the same color with CSS. But the way this utility works drove me nuts…

Setting the pulldown to “RGB as Hex Value, 8-bit” sounds right. Then put the aperture over the color you want, hit command+shift+c and you have the hex rgb in your clipboard. Nice! So go paste that into your css editor and you get:

Note the quotes
Note the quotes

So now I have to go in and remove the quotes manually each time. But then, it still does not work when you view the web page. Turning on hidden characters reveals…

What a mess
What a mess

“… just… like… WHY, Steve?” An otherwise nice utility is a real pain to do anything useful with.

Well, tonight I found a good workaround for this. In the preferences, turn on “Drag in swatch drags out the color”:
Picture 5 Then, Instead of command+shift+c, do a command+shift+h. That holds the color instead of copying it:

Picture 4 Then drag that chip in the middle to where you want to copy the hex…

Picture 8

And there you have it:

Picture 7

Now… as to why it is holding F39200 but dragged F88D00? I have no idea! Comments, suggestions, etc are welcome.

The loudest word

The loudest word you can yell at a company is comprised of a single character. It’s made by holding down shift and pressing 4. This should work wonderfully but is flawed by people who are attracted to shiny objects.

What am I talking about? Apple’s decision to not sell matte screened desktops and portables.

There are a lot of angry people of Apple’s decision to not make glossy/matte screens an option. I want matte. I’m close to buying a new machine and I’d like it to be another iMac. But I’ve experienced the v7.1 (aluminum/glossy) and it’s horrible.

I don’t need to be looking at my reflection when I’m programming 12~16 hours a day. My eyes are confused on what depth to put focus on so it’s constant fatigue and strain. And I can’t do proper color correction because of the reflections. I also noticed what a bad job the display does at rendering subtle gradients. Banding like crazy. I think Apple put on a glossy screen to hide the driver’s or display’s ability to function at an acceptable level.

Are these images jokes?

home_hero20081014

overview-gallery1-20090106

Color correction? With glossy screens? In a cave maybe. But my office has lights and light colored walls and objects.

So back to my original statement. People are attracted to shiny objects. They look cool. So it doesn’t matter if smart professionals speak with their wallets. The unknowing masses will continue to buy inferior products so they can impress people they don’t like. It’s just sad.

I really tried writing this to not sound ranty or whiney. But it’s something I feel passionate about. And it’s got to change if I’m to buy another all-in-one. I can’t sell my car in order to afford a Mac Pro and peripherals to go with it!

Well hey… maybe Psystar will save the day!

Switching Tips – from Leopard to Vista

I’ve been a Mac user since 1990. I do all of my work on a Mac. And I know them in and out. And having to use all OSes in my field of work, I can make an educated decision that Apple products, to quote Steve, are “really great”.

So when it came time to get my wife a new laptop to replace the Titanium PowerBook 677Mhz, of course I was thinking of another Mac. The primary use is transcribing audio tapes (Word), then blogging, photos and other family stuff. Laptops can handle that pretty well. And we also use it on family trips so I can remote pilot back at home, etc. No heavy lifting.

Competition

I was going to buy another Mac. Really, I was. It was almost going to be the $1300 Aluminum 13 inch MacBook. Then I saw a Dell at Best Buy. More ram than the MacBook, same storage and processor. Much less dough. For $550 I picked up the Dell Inspirion T3200. My wife had been a PC user her whole life so switching back for her would be no problem.

Apple folk will swear up and down that Apple hardware is no more expensive than a closely configured PC. So lets do some comparative shopping right now.

Apple Aluminum 13 inch MacBook

  • Intel Core 2 Duo @ 2GHz
  • 2GB DDR3 Memory
  • 160GB hard drive
  • NVIDIA GeForce 9400M graphics
  • 13″, 1280×800
  • Mac OS X v10.5 Leopard, iLife 08

Dell Inspirion T3200

  • Intel® Pentium® Dual-Core @ 2GHz
  • 3GB DDR2 Memory
  • 160GB hard drive
  • Intel® Graphics Media Accelerator X3100
  • 15″, 1280×800
  • Windows Vista Home Premium, MS Works 9

That’s without nit-picking the details (dell has more ports and larger screen, but shared video ram and Vista, etc). If you want to split hairs, feel free to use the links above. It looks like the Apple is better. I don’t think $750 better, but better nonetheless. Wow, I just realized it’s over 2x the cost! $100 per inch.

Software

It took about three days to find adequate software to mimic the previous setup. Like so:

  • Usage: Mac / PC
  • Web Browsing: Firefox / Firefox
  • Photo Management: iPhoto / Picasa
  • Instant Messaging: Adium / Trillian
  • Email: Mail / Thunderbird
  • Blogging: iPhoto+Mail+blogger.com / Picasa
  • Remote Pilot: VNC / ??

Finding and testing programs is one thing. What about moving over all your stuff? Photos, passwords, mail, etc etc. This is how I pulled it off. It went quite well.

Web Browser

This wasn’t too hard because we’re used to (and prefer) Firefox. Installing Firefox was easy of course. Then to not skip a heartbeat, I installed Foxmarks plugin on the old Mac. Foxmarks is a free add-on for Firefox that syncs and backs up your bookmarks and passwords across multiple computers. Then chose the option to copy over passwords. Then I installed it on the PC’s Firefox and synced down. Perfect! All bookmarks and logins are remembered. WHEW.

Photo Manager

Weeks ago I was so happy because I bought a nice Canon camera that captured video as MP4 (h.264) .MOVs. Sweet! Now they import into iPhoto without fuss and are smaller than AVI.
And here I am, now with a PC. Murphy. Luck. Whatever. Moving on…

Sadly, there is no free equivalent of iPhoto for the PC. And in some ways thats a good thing. Picasa is probably the closest. And after trying a dozen, it’s the one I settled on.

iPhoto keeps it’s own secret storage facility masked by the OS as a sinlge file in your User’s directory. Picasa keeps an eye on a directory in your computer. This is both good and bad.
It’s easy to replace files with picasa, such as re-encoding a video. Doing that manually in iPhoto is a nightmare. Video files don’t store meta info such as the date taken.

In iPhoto, I filtered all photos by month. Then created that month’s folder on the PC. Over the LAN, I drag and dropped from iPhoto to the mounted drive (and the month’s folder). This took many night because the TiPB is so dang slow.

After importing the existing photos from the old mac, Picasa made quick work of it. Very very fast! Afterwards, I used QTAmateur on my iMac to batch convert all the old huge AVIs into smaller but visually identical MP4s. Again, directly over the LAN with a mounted share. Launch Picasa, and it updates automatically, re-reading the dir contents.

But wait… Picasa does not import video from the camera! DOH. So I use MS’s built in function to grab the photos and place them automatically into a folder. Launch Picasa, and it updates automatically – again.

Instant Messaging

On the Mac we were using the multi protocol, and awesome, Adium. They do not make Adium for other platforms. But Trillian filled the hole quite well. Since both AOL and Yahoo! store the buddy list contacts on their end, there was no export/import work to do. Just log in and chat. Nice!

Email

I really liked Mail.app on the Mac. But no equal for the PC. I installed Thunderbird. Since all of our accounts are IMAP, moving over was a breeze. I just had to set up the accounts and wait a few minutes. Done!

Blogging

My wife uses blogger.com. I think their RTE majorly sucks really really bad. Google programmers should be ashamed. (Ask me how I really feel). But the nice thing is that posting articles to blogger can be done right inside of Picasa with images. How cool! But only 4 images… don’t get me started. WT…. why only ffoouurr?? It’s just crazy.

WVFM (WebVeteran File Manager) build 081008

I haven't come across any ColdFusion file manager that is good, free, and can be used with TinyMCE. Even the commercial products don't impress me. And  don't like relying on PHP in my CF applications. So I'm writing my own File Manager, WVFM. Sounds like an oldies station 🙂 I plan on releasing it as open source for free.

The following are my main goals for WVFM:

  • Speed
  • Aethetics
  • Easy to install
  • Easy to use

I plan to accomplish those goals with:

  • Optimized code (CFML and HTML/CSS)
  • FamFamFam Silk Icons, and a designer willing to help for free
  • AJAX w/ Scriptaculous web2.0 javascript library
  • Mimics Mac OSX Finder's column view navigation
  • Extra information for webmasters and content editors

Right now it's pretty much a drag and drop CFC. It runs immediately by navigating to its loader (index.cfm) with good default settings.

It figures out the root dir of the website, and if you're navigating within it, allows you to click on files to view/listen/download.

Every attribute of a file/dir is sortable. Sorting is prioritzed automatically as you sort by attribute. That sorting is saved as a cookie for when you return.

You can specify which attributes of the objects you need to see. The code is optimized to not bother asking the file system for those attributes. Good optimization for a large number of objects in a directory.

WebVeteran File Manager 081008

More to come! Next is making navigation like Finder's column view.

 

New Wallpaper for the iPhone and iPod Touch

I've added a new download to my repo, http://www.webveteran.com/repo/

It is a wallpaper, poking fun at jailbreaking:

The graphics and text leave ample room for Springboard icons, the Dock, pages, and the unlock screen interface.

To get the full size, you need to load my repository into intaller.app, then look in the Wallpaper section for "Get Out Of Jail Free".

Making a smaller virtual XP machine disk

The problem

As you use your virtual machine, it will continue to grow in size. I have my virtual XP machine to maximum of 10GB. All I really need it for is testing sites in IE6 (ick) and connecting to a SQL Server (ew). After installing a few things, running all Windows Updates… my vanilla XP is using 8GB. Wha? All I have installed is WinAmp, Cisco VNC Client, and SQL Manager. Whats going on?

“Well, when Windows deletes a file, it doesn’t actually
delete the data in the disk; it just deletes the references/pointers in
the file allocation table. So when ESX is exporting a VMDK and is
looking at the raw disk, it’s seeing values that aren’t empty
(non-zero), and exports them as such. The result is more disk space is
used and takes longer to export the disk.”
http://www.rtfm-ed.co.uk/?p=40

The solution

What we want to do is remove all unneccesary files. Caches, installer temps, restore points, and useless software. Then use VMware’s Shrink utility to reclaim the disk space. Other virtualization vendors will have similar solutions which may
vary. But the build up to the final ‘shrink’ is the same. All steps are
carried out in the guest Windows XP virtual machine.

Results and Benefits

  • Smaller guest OS footprint (mine went from 8GB to 3GB)
  • Smaller virtual disk on the host
  • When zipped, the virtual disc is smaller again (mine is 1.4GB) – making it much more portable
  • With a cleaner guest OS, it runs much faster
  • Suspend/Resume is close to instant

Turn Off Unnecessary Windows XP Services

First I turned off all Windows XP Services I did not need. You’ll have to deceide what you do and don’t want. You can do so from Services in Administrative Tools. Double click services you don’t want needlessly eating resources, Stop the service, then set the Startup Type to ‘Manual’ or ‘Disable’. Apply. OK. Do that to all services you don’t want running, then reboot the machine. Not sure what to disable? Jason A. Nunnelley has a good writeup: Turn Off Unnecessary Windows XP Services.

Uninstall Unused Windows Components

Next I deleted all Windows Components I’d not need. You’ll have to deceide what you do and don’t want. You can do so from Add/Remove Windows Components button of the Add/Remove Programs control panel. Double click each item, continuosly, to turn off anything you don’t want. Like extra Mouse Pointers, or Paint.exe. If using the typical Microsoft 85 pixel high scrolling window isn’t your thing, try using XPLite instead. It’s a nice GUI with even more options.

Turn off system restore

  • Right click My Computer; select properties
  • Click the System Restore tab
  • Click the “Turn off System Restore” checkbox

Set Visual Effects to minimum

  • Right click My Computer; select Properties
  • Click the Advanced tab
  • Click the Performance Settings button
  • Click the “Adjust for best performance” checkbox

Clean the XP Drive

This will get all your bits in order. Run a defragmentation on your XP drive. This usility is located in: Start/Programs/Accessories/System Tools/Disk Cleanup
You can decide what to clean and keep. I deleted everything. This takes a little while.

Defragment the XP Drive

This will get all your bits in order. Run a defragmentation on your XP drive. This usility is located in: Start/Programs/Accessories/System Tools/Disk Defragmenter
It may take a while. Whisper words of wisdom, let it be.

Finally… the magic

Here is where the instructions branch, depending on whether you use Paralles, VPC, or VMWare. I have VMware, so these are the instructions for it…
Double click the VMware Tools icon in the Sytem Tray.
Click the Shrink tab. Tick the checkbox for your drive. Then click ‘Prepare to Shrink’. This will take a long time, longer if you cleaned a lot of space above.
Eventually it will ask you is you want to shrink your disk(s) now. Ya think? Click Yes. This will also take a long time.

Conclusion

And that’s all folks. You should now have a very slim XP virtual machine. I noticed mine running much faster. And with zip compression, it is now much more portable, at only 1.3 GB.

Resources

Of course, I did not figure this out all by myself.