How to Forward Spam Sent to Spamtraps to SpamCop using qmail

I have a number of email addresses that get nothing but spam, and I like to feed these to SpamCop's quick reporting service. This is easy to do with qmail, if you know how and if you have a paid SpamCop account.

  1. Create a spamtrap account and add all spam addresses as aliases (I do this with Plesk).
     
  2. Create /var/qmail/mailnames/example.com/spamtrap/spamcop-digest-header
    From: <spamreporter@example.com>
    To: "SpamCop QuickReporting" <quick.YourIdHere@spam.spamcop.net>
    Subject: Forwarded Spam
    MIME-Version: 1.0
    Content-Type: multipart/digest; boundary="======DeathToSpam======"
    
    --======DeathToSpam======
    
  3. Create /var/qmail/mailnames/example.com/spamtrap/spamcop-digest-footer
    
    --======DeathToSpam======--
    
  4. Change /var/qmail/mailnames/example.com/spamtrap/.qmail to look like this:
    | true
    | cat spamcop-digest-header - spamcop-digest-footer | sendmail -t -fspamreporter@example.com
    

That's all there is to it — of course you must be sure that you really don't get anything but spam at the addresses that you treat this way! SpamCop will send you the results of your reporting.