Jump to content


  • Posts

  • Joined

  • Last visited

littletinybun's Achievements


Newbie (1/6)



  1. I haven't used this service for a few years but I decided to give it a try again. I went through my Junk Mail forder and unmarked ( as Not Junk ) some myspace emails that got caught in Apples filter and moved them to the inbox. I ran my applescript below to have all the junk automatically sent to spamcop. I went to check what it sent and sure enough it still sent the email headers of the emails I had removed and marked not junk . Before I get banned as a free user what went wrong ? Applescript macro on run global gAttachmentList global gTempItemsPath global gFileName set theTo to "submit.4m2uozXHiQSwoNIx[at]spam.spamcop.net" & ",spam[at]uce.gov" set gAttachmentList to {} as list set gTempItemsPath to (the path to the temporary items folder) as text set sendSpam to 0 set theSentList to {} as list tell application "Mail" activate set spamFolder to junk mailbox set theMessages to messages in spamFolder as list if the (count of theMessages) = 0 then beep return end if repeat with theMsg in theMessages my ProcessMsg(theMsg) copy theMsg to end of theSentList end repeat set theCount to the count of gAttachmentList if theCount is 0 then beep return end if set theBody to "" if theCount is 1 then set origMsg to item 1 of theMessages set theSubject to the subject of origMsg if theSubject does not start with "FW: " then set theSubject to "FW: " & theSubject end if else set theSubject to "FW: " & theCount & " spam messages" as text end if set newMessage to make new outgoing message with properties {visible:true, subject:theSubject, content:theBody & return & return} tell newMessage -- If you'd like to specify an outgoing email account uncomment the line below and change it to your outgoing email address -- set sender to "outgoing[at]email.account" make new to recipient at end of to recipients with properties {name:"Spamcop", address:theTo} repeat with theAttachment in gAttachmentList tell content to make new attachment with properties {file name:theAttachment} at after the last paragraph end repeat end tell activate send newMessage delete theSentList end tell end run on ProcessMsg(theMsg) global gAttachmentList global gTempItemsPath global gFileName tell application "Mail" try -- Give each message file a name which includes a six digit random number set theRandom to random number from 100000 to 999999 with seed (the subject of theMsg) set gFileName to "temp-" & (theRandom as text) -- comment out the 6 lines below if naming the messages according to their subject doesn't work for you set errNum to my GetMessageFilename(gTempItemsPath, theMsg) if errNum is not 0 then activate display dialog "Error while attempting to save file. ID=" & errNum buttons {"OK"} default button 1 return end if set theFilePath to gTempItemsPath & gFileName -- Use the following line instead of the above line to put the temp files on the Desktop -- set theFilePath to ((path to desktop) as Unicode text) & gFileName set theFileID to open for access file theFilePath with write permission write (source of theMsg as text) to theFileID close access theFileID set theAlias to theFilePath as alias set gAttachmentList to gAttachmentList & {theAlias} set was forwarded of theMsg to true on error errMsg activate display dialog errMsg buttons {"OK"} default button 1 end try end tell end ProcessMsg on GetMessageFilename(theFolderPath, theMsg) global gFileName -- construct a file name for the message -- To do this we must replace all colons w/ semi-colons -- and then truncate the name if necessary tell application "Mail" set msgSubject to the subject of theMsg end tell set theName to "" repeat with x in the characters of msgSubject set aChar to x as text if aChar is ":" then set aChar to ";" set theName to theName & aChar end repeat -- all colons are removed, now truncate it in the middle if necessary set nameLength to the length of theName if nameLength is greater than 31 then set theHalfLength to nameLength / 2 if theHalfLength is greater than 15 then set theHalfLength to 15 set theNewName to (characters 1 thru theHalfLength of theName) & "…" & (characters (nameLength - (theHalfLength - 1)) thru nameLength of theName) set theName to theNewName end if set gFileName to theName as Unicode text set errNum to my CheckFileName(theFolderPath) return errNum end GetMessageFilename on CheckFileName(theFolderPath) global gFileName set theCount to 0 set tempName to gFileName set nameLen to the length of gFileName -- if the file already exists in the temp items folder then change its name by adding a number to the end so as to make the filename unique repeat if theCount > 0 then set countString to " " & (theCount as text) set countLen to the length of countString set totalLen to nameLen + countLen if totalLen < 32 then set tempName to tempName & countString else set tempName to (characters 1 thru (31 - countLen) of gFileName) & countString end if end if set theFilePath to theFolderPath & tempName try set theAlias to theFilePath as alias -- The file already exists! on error errMsg number errNum if errNum is -43 then set gFileName to tempName return 0 -- file doesn't exist yet, yahoo! else activate display dialog errMsg buttons {"OK"} default button 1 return errNum end if end try set theCount to theCount + 1 if theCount > 9999 then return -36 end if end repeat return -36 end CheckFileName
  • Create New...