frenchkiwi Posted February 1, 2004 Share Posted February 1, 2004 Hi there, For Macintosh Users only : 3 very useful Applescripts to automate SpamCop reporting by email Go to http://www.scriptbuilders.net/category.php?search=spamcop to download them. In my case I use Entourage v.X as my main email system, with the AppleScript SpamCop report 1.0 found on this www.scriptbuilders.net/ website. It works just great used standalone, and even better with Entourage v.X rules. Saving me a lot of time every day to do my reporting to Spamcop !!! --------------------------------------------------------------------------------------------------------------- Eudora to SpamCop 1.1 GPL | 7.16.03 | scri_pt #1382 Author: Kristofer Widholm | Developer's Web Site OSAXen Needed: None Requirements: Eudora 6 (Eudora 5.2 with Junk option disabled) scri_pt Type: Editable Category: Eudora Release Notes: This is an AppleScript for quickly reporting spam to SpamCop from within Eudora. In addition to queueing a properly formatted spamreport message in your outbox, it has the following features: 1. NEW!: Submission of multiple selected messages at one invocation. 2. If message has been left on server, scri_pt can be configured to set that message to be deleted. 3. Attachments to the spam are deleted automatically, with or without notification, according to user preferences. 4. scri_pt can mark the spam as read, and can optionally trash it or move it to the Junk folder. Unfortunately, there aren't adequate verbs in Eudora's AppleScript dictionary for a robust implementation of the Junk mail feature. Moving an e-mail to the Junk folder does assign a score of 100 to it (though it takes a while to see that), but I'm not sure if it properly updates the Bayesian filters the way the Junk command does. Consider it a workaround implementation until we either get native verbs for it, or until keystroke programming becomes standard in Mac OS X. * By the way, I believe this should work with Eudora 5.2 as well, though obviously without the Junk mail funtionality. --------------------------------------------------------------------------------------------------------------- Report spam 1.0 Freeware | 5.21.03 | scri_pt #1159 Author: Jan Pieter Kunst | Developer's Web Site OSAXen Needed: None Requirements: Outlook Express 5, Internet Explorer 5, SpamCop acct scri_pt Type: Editable Category: Outlook-Express Release Notes: This scri_pt works with Outlook Express 5 and Internet Explorer 5. It assumes the user has an account with the SpamCop spam reporting service at http://spamcop.net/ --------------------------------------------------------------------------------------------------------------- SpamCop Report 1.0 Freeware | 5.21.03 | scri_pt #1169 Author: Allen Watson | Developer's Web Site OSAXen Needed: None Requirements: Entourage scri_pt Type: Editable Category: Entourage Release Notes: To use this scri_pt you must sign up with www.spamcop.net to get a free email address for reporting your spam. Please read the instructions on the web site carefully about selecting messages to report as spam. When you sign up, you will be sent an email message containing two email addresses, one for quick reporting and one for full reporting. You can use either one with this scri_pt. Link to comment Share on other sites More sharing options...
Wazoo Posted August 3, 2006 Share Posted August 3, 2006 The starting referenced URL did not work for me. http://scriptbuilders.net/ for me the front page .... inserting 'spamcop' into the "Search ScriptBuilders" box returned the identified three items. None of them appear to have been updated in a long while. The scriptbuilders page is actually a sub-page of http://macscripter.net/ Link to comment Share on other sites More sharing options...
l008com Posted August 20, 2006 Share Posted August 20, 2006 I use Thunderbird to report. It lets you click on all of your spam, and forward it as one email, but spamcop still sees all the individual emails, with full headers. It would be nice if there was an even easier way, like ideally a mail.app plugin with a toolbar icon, but using thunderbird is an OK way to go. Link to comment Share on other sites More sharing options...
RK-Hates-Spam Posted September 19, 2006 Share Posted September 19, 2006 Hi all, I have come up with an AppleScript that integrates with Safari and Mac OS 10.4 to perform rudimentary reporting of all email messages in your junk mail box in Mail.app. Give it a try! Obviously, you want to be certain everything that has been tagged as spam actually *is* spam before running this... :-) Don't forget to post any improvements/suggestions! Enjoy! -- -- NOTE: scri_pt assumes you are always cookied/logged into SpamCop.Net for reporting -- tell application "Safari" activate close every window set myDoc to (make new document) set URL of myDoc to "http://www.spamcop.net/" end tell if WaitForPage(30) is false then stop end if tell application "Mail" set msgList to (messages of junk mailbox) set msgCount to (number of items in msgList) end tell if (msgCount > 0) then say "Processing" & msgCount & " messages from junk mailbox..." repeat with i from 1 to msgCount try tell application "Mail" set topMsg to item i of messages of junk mailbox set rawMsg to source of topMsg set the clipboard to rawMsg end tell ProcessMsgText() on error the error_message number the error_number end try end repeat tell application "Mail" delete every message of junk mailbox end tell else say "Skipping junk mailbox..." end if say "Done" tell application "Safari" quit end tell on ProcessMsgText() tell application "Safari" activate set URL of document of window 1 to "http://www.spamcop.net/" delay 3 end tell if WaitForPage(20) is true then tell application "System Events" tell process "Safari" delay 0.5 keystroke (ASCII character 9) keystroke (ASCII character 9) click menu item "Paste" of menu 1 of menu bar item "Edit" of menu bar 1 delay 0.5 keystroke (ASCII character 13) keystroke (ASCII character 10) keystroke (ASCII character 13) delay 0.5 keystroke (ASCII character 9) keystroke (ASCII character 32) end tell end tell WaitForSpamCop() end if end ProcessMsgText on WaitForSpamCop() delay 5 if WaitForPage(30) is true then tell application "Safari" set resultPageTitle to (name of window 1) end tell if (resultPageTitle is "SpamCop.net") then ProcessSpamCop() else delay 3 if WaitForPage(30) is true then tell application "Safari" set resultPageTitle to (name of window 1) end tell if (resultPageTitle is "SpamCop.net") then ProcessSpamCop() else delay 5 if WaitForPage(30) is true then tell application "Safari" set resultPageTitle to (name of window 1) end tell if (resultPageTitle is "SpamCop.net") then ProcessSpamCop() end if end if end if end if end if end if end WaitForSpamCop on ProcessSpamCop() delay 3 tell application "Safari" set resultPageHTML to source of document 1 set PROCESS_SPAM_BUTTON_SRC to "Process spam" set SEND_SPAM_REPORTS_BUTTON_SRC to "Send spam Report(s) Now" set processedOK to ((offset of SEND_SPAM_REPORTS_BUTTON_SRC in resultPageHTML) > 0) end tell if (processedOK) then tell application "Safari" do java scri_pt "document.sendreport.submit();" in document 1 end tell end if delay 3 end ProcessSpamCop on WaitForPage(timeout_value) delay 2 repeat with i from 1 to the timeout_value tell application "Safari" try if (do java scri_pt "document.readyState" in document 1) is "complete" then return true else if i is the timeout_value then return false end if on error the error_message number the error_number end try delay 1 end tell end repeat return false end WaitForPage Link to comment Share on other sites More sharing options...
Wazoo Posted September 20, 2006 Share Posted September 20, 2006 I have come up with an AppleScript that integrates with Safari and Mac OS 10.4 What version(s) of Safari? What is in this scri_pt that makes it 'require' 10.4? Link to comment Share on other sites More sharing options...
RK-Hates-Spam Posted September 22, 2006 Share Posted September 22, 2006 What version(s) of Safari? What is in this scri_pt that makes it 'require' 10.4? I'm using Version 2.0.4 (419.3) of Safari. Nothing here "requires" 10.4(.7) that I'm aware of but this was a 3-hour hack to help me report spam automatically, so YMMV. That said, below is version 2. I've removed System Events from the link-up to Safari and have used JS for more robust interactions with AppleScript. And yes, it's now more like a 6 hour hack. :-) Enjoy! --- -- -- Send junk mail from Mail.app's junk mail into SpamCop -- -- scri_pt ASSUMES you are cookied / logged into SpamCop.net -- -- Revised 9/21/06 -- -- v 1.0 - RK-Hates-spam - Created -- v 2.0 - RK-Hates-spam - Replaced System Events with java scri_pt for data passing & form submits -- tell application "Safari" close every window set myDoc to (make new document) set URL of myDoc to "http://www.spamcop.net/" end tell if WaitForPage(30) is false then stop end if tell application "Mail" set msgList to (messages of junk mailbox) set msgCount to (number of items in msgList) end tell if (msgCount > 0) then say "Processing" & msgCount & " messages from junk mailbox..." repeat with i from 1 to msgCount try tell application "Mail" set topMsg to item i of messages of junk mailbox set background color of topMsg to gray set rawMsg to source of topMsg end tell SubmitSpamToSpamCop(rawMsg) on error the error_message number the error_number end try end repeat tell application "Mail" delete every message of junk mailbox end tell else say "Skipping junk mailbox..." end if say "Done" tell application "Safari" quit end tell on SubmitSpamToSpamCop(rawMsg) tell application "Safari" set URL of document of window 1 to "http://www.spamcop.net/" delay 1 end tell if WaitForPage(20) is true then set fixedMsg to TrimForLength(rawMsg, 49000) set fixedMsg to ReplaceChars(fixedMsg, "\"", "\\\"") set fixedMsg to ReplaceChars(fixedMsg, "'", "\\'") set fixedMsg to ReplaceChars(fixedMsg, ((ASCII character 10) as string), "\\n") set fixedMsg to ReplaceChars(fixedMsg, ((ASCII character 13) as string), "\\r") tell application "Safari" do java scri_pt "document.forms['submitspam'].elements['spam'].focus()" in document 1 do java scri_pt "document.forms['submitspam'].elements['spam'].value=\"" & fixedMsg & "\"" in document 1 do java scri_pt "document.submitspam.submit();" in document 1 end tell WaitForSpamCopToProcessSpam() end if end SubmitSpamToSpamCop on WaitForSpamCopToProcessSpam() delay 5 if WaitForPage(30) is true then tell application "Safari" set resultPageTitle to (name of window 1) end tell if (resultPageTitle is "SpamCop.net") then ProcessSpamCopResults() else delay 3 if WaitForPage(30) is true then tell application "Safari" set resultPageTitle to (name of window 1) end tell if (resultPageTitle is "SpamCop.net") then ProcessSpamCopResults() else delay 5 if WaitForPage(30) is true then tell application "Safari" set resultPageTitle to (name of window 1) end tell if (resultPageTitle is "SpamCop.net") then ProcessSpamCopResults() end if end if end if end if end if end if end WaitForSpamCopToProcessSpam on ProcessSpamCopResults() delay 3 tell application "Safari" set resultPageHTML to source of document 1 set PROCESS_SPAM_BUTTON_SRC to "Process spam" set SEND_SPAM_REPORTS_BUTTON_SRC to "Send spam Report(s) Now" set processedOK to ((offset of SEND_SPAM_REPORTS_BUTTON_SRC in resultPageHTML) > 0) end tell if (processedOK) then tell application "Safari" do java scri_pt "document.sendreport.submit();" in document 1 end tell end if delay 3 end ProcessSpamCopResults on WaitForPage(timeout_value) delay 2 repeat with i from 1 to the timeout_value tell application "Safari" try if (do java scri_pt "document.readyState" in document 1) is "complete" then return true else if i is the timeout_value then return false end if on error the error_message number the error_number end try delay 1 end tell end repeat return false end WaitForPage on TrimForLength(this_text, max_len) if length of this_text > max_len then return (text 1 thru max_len of this_text) end if return this_text end TrimForLength on ReplaceChars(this_text, search_string, replacement_string) set AppleScript's text item delimiters to the search_string set the item_list to every text item of this_text set AppleScript's text item delimiters to the replacement_string set this_text to the item_list as string set AppleScript's text item delimiters to "" return this_text end ReplaceChars Link to comment Share on other sites More sharing options...
Wazoo Posted September 22, 2006 Share Posted September 22, 2006 I may be missing something in the "processspam..." section, but .. it looks at first glance that there's no chance for the user to review, select, un-select offered up targets of which reports and targets that show up in the parse results .... this is the 'automatic reporting mode' that has gotten many folks into trouble in the past ... Link to comment Share on other sites More sharing options...
RK-Hates-Spam Posted September 22, 2006 Share Posted September 22, 2006 I may be missing something in the "processspam..." section, but .. it looks at first glance that there's no chance for the user to review, select, un-select offered up targets of which reports and targets that show up in the parse results .... this is the 'automatic reporting mode' that has gotten many folks into trouble in the past ... No, you're not missing anything and you make a good point. In the original post I mentioned the need to pre-validate spam but I'll say it again to be perfectly clear: I ONLY run this scri_pt AFTER going through my "Junk Mail" mailbox and MANUALLY DELETING regular (i.e. "OK") spam. I've read about folks getting fined/banned for reporting sans discrimination and have no desire to do/be the same. Thanks for bringing that up! -RK Link to comment Share on other sites More sharing options...
turetzsr Posted September 22, 2006 Share Posted September 22, 2006 No, you're not missing anything and you make a good point. In the original post I mentioned the need to pre-validate spam but I'll say it again to be perfectly clear: I ONLY run this scri_pt AFTER going through my "Junk Mail" mailbox and MANUALLY DELETING regular (i.e. "OK") spam. <snip> ...But will that precaution avoid the problem that I mentioned in thread "Quick Reporting Held Mail?" Link to comment Share on other sites More sharing options...
RK-Hates-Spam Posted September 23, 2006 Share Posted September 23, 2006 ...But will that precaution avoid the problem that I mentioned in thread "Quick Reporting Held Mail?" Hopefully. Can't FORCE people to be intelligent about a tool any more than you can FORCE gun control. Use it well or do not - hopefully most will fall into the former! Link to comment Share on other sites More sharing options...
turetzsr Posted September 25, 2006 Share Posted September 25, 2006 ...But will that precaution avoid the problem that I mentioned in thread "Quick Reporting Held Mail?" Hopefully. <snip> ...Can you explain how so that users of your tool know what they should do to avoid the problem? Thanks! <g> Link to comment Share on other sites More sharing options...
AlexK Posted October 4, 2006 Share Posted October 4, 2006 How is this scri_pt for Mail.app to work? I tried to copy it into the scri_pt Editor and run it, but I get an error that says "Expected end of line but found identifier" in this line. The wod "java" is highlighted. tell application "Safari" do java scri_pt "document.forms['submitspam'].elements['spam'].focus()" in document 1 Any tips on what I am doing wrong? I really want to give this a try. Link to comment Share on other sites More sharing options...
Wazoo Posted October 4, 2006 Share Posted October 4, 2006 Let's rule out the ovbious .... there is a very heavy-handed code modification in place in this Forum, placed there due to some previous exploits, one of which was used a while back to hack the account of one of the Moderators.. In the case of this code (and your post, if you didn't notice) there are some changes to certain data typed in, stored, and displayed .... the 'change' is obvious, so I don't feel the need to go into much detail on the specifics .. but the question would be ... 'did you correct what you copied before saving it and trying to run it?' Based on where you said the error was high-lited, I'm guessing you didn't. The code posted was reviewed by me to verify that there was only the one word involved in this code sample, and again, it is still my opinion that it's very obvious. Link to comment Share on other sites More sharing options...
AlexK Posted October 7, 2006 Share Posted October 7, 2006 Oops, now that I read what happened to the word "scri_pt" in my post, I actually feel a little embarrassed. Sorry for not looking close enough. Is it only this word that gets changed or do I have to look out for other words being changed. Can I see a full list of "crippled" words somewhere in this forum? And thanks Wazzoo for point out the obvious. Link to comment Share on other sites More sharing options...
Wazoo Posted October 7, 2006 Share Posted October 7, 2006 Oops, now that I read what happened to the word "scri_pt" in my post, I actually feel a little embarrassed. Sorry for not looking close enough. Is it only this word that gets changed or do I have to look out for other words being changed. Can I see a full list of "crippled" words somewhere in this forum? And thanks Wazzoo for point out the obvious. I'd really rather not disclose the 'list' .... as I stated, I did review the code, looking for a number of things. Had other words been effected, I would have come up with some kind of work-around .... the issue is that this word is the only obvious one that is still spelled somewhat correctly, broken enough though that it won't parse ..... it gets used to often around these parts to have handled it like I did the others .... the others actually get changed to another word .. which actually will also be obvious if / when that happens .... well, some to all, others probably only to the programmer and myself at first glance .... it's not that often that code gets published here, and this Forum app is very high on the hacking target list. But, that it came up as a problem, I will add a note to the Forum FAQ about the situation ..... Link to comment Share on other sites More sharing options...
dczward Posted October 8, 2006 Share Posted October 8, 2006 I was able to get this scri_pt working with my spam Sieve "spam" folder. I changed the "junk mailbox" reference to "mailbox ("spam")", and it worked. Still is a bit slow, but at least it works. Thanks for the scri_pt. Link to comment Share on other sites More sharing options...
Wazoo Posted October 8, 2006 Share Posted October 8, 2006 I was able to get this scri_pt working with my spam Sieve "spam" folder. I changed the "junk mailbox" reference to "mailbox ("spam")", and it worked. Still is a bit slow, but at least it works. Thanks for the scri_pt. OK, fine .... wasted effort on my part trying to troubleshoot and write-up all the steps involved ... Will state that there is some apparent 'version dependency' involved ... Attempting to run this under OS-X 10.2.x has a major complaint with the line; set background color of topMsg to gray error: "A class name can't go after that identifier" Commenting out that line allowed it to 'compile' .... at least the "Check Syntax" button doesn't error our and the file gets formatted ... Trying the "Run" button gets me the error message; Safari got an error: NSArgumentScriptError ..... with the following line highlited; set myDoc to (make new document) But that may also tie into that I wasn't going to let it actually 'run' as I am very uncomfortable with the 'automatic' mode involved .... (probably not an issue, as the 'junk folder' on the iBook is empty, but .....per the 'assumptions', I am/was not 'logged in to SpamCop.net) Two others have got it running, si I'll get back to other things myself .... Link to comment Share on other sites More sharing options...
msealey Posted October 15, 2006 Share Posted October 15, 2006 Given that SpamCopSend doesn't work in Tiger and SpamRoboCop appears defunct, what is the preferred way to automate reporting to SpamCop from Apple Mail 2 in 10.4? Thanks! Link to comment Share on other sites More sharing options...
Wazoo Posted October 15, 2006 Share Posted October 15, 2006 Given that SpamCopSend doesn't work in Tiger and SpamRoboCop appears defunct, what is the preferred way to automate reporting to SpamCop from Apple Mail 2 in 10.4? Not endorsed, yet ... trying to figure out how you missed this Topic ... it was still on the first page of displayed Topics, Subject line is reasonably clear .... PM sent to advise of the Merge of this post into an existing Topic/Discussion. Link to comment Share on other sites More sharing options...
msealey Posted October 19, 2006 Share Posted October 19, 2006 I have come up with an AppleScript that integrates with Safari and Mac OS 10.4 to perform rudimentary reporting of all email messages in your junk mail box in Mail.appThanks! Works perfectly. Is there an easy way to have each message populate successive SpamCop forms in Safari tabs? Link to comment Share on other sites More sharing options...
kiberkli Posted October 25, 2006 Share Posted October 25, 2006 Hi All, I saw these scripts after I had written my own. I have improved on my original scri_pt and the result is now available here: ht tp://homepage.mac. com/kib/spamcoptool/SpamCopTool.zip Mac OS X 10.4 required, using Mail.app and Safari. Please read the Read Me. Let me know what you think. Thanks. Moderator Edit: URL broken by editing Link to comment Share on other sites More sharing options...
Wazoo Posted October 26, 2006 Share Posted October 26, 2006 I saw these scripts after I had written my own. I have improved on my original scri_pt and the result is now available here: ht tp://homepage.mac. com/kib/spamcoptool/SpamCopTool.zip Mac OS X 10.4 required, using Mail.app and Safari. Please read the Read Me. Let me know what you think. A ".dmg" file wrapped up inside a .ZIP archive .... I'm not really in the mood to try to resurrect an iBook one more time just to get to where I might possibly get to the point to even see a "Read Me" file ..... Therefore, as the actual file contents are an unknown, URL broken just to make sure that anyone thinking of snagging it is going to have to make a real concious decision. If it's really great and wonderful, thanks for the work, thanks for the sharing. However, given the lack of details provided here (or there) ..... Link to comment Share on other sites More sharing options...
kiberkli Posted October 26, 2006 Share Posted October 26, 2006 If it's really great and wonderful, thanks for the work, thanks for the sharing. However, given the lack of details provided here (or there) ..... Here ya go: http://homepage.mac.com/kib/spamcoptool/spamcoptool.html If you're afraid to download or run the application I'll post the source a bit later today. Link to comment Share on other sites More sharing options...
Farelf Posted October 26, 2006 Share Posted October 26, 2006 Thanks kiberkli. I notice you prudently add a note "If there is a problem with the use of the term 'SpamCop.net' or 'SpamCop' please let me know." I can't speak for SpamCop but AFAIK, not only would there be no problem, spreading the brandname is encouraged. You can even add a logo and link if you want: May I create a link to SpamCop from my site? Link to comment Share on other sites More sharing options...
Wazoo Posted October 26, 2006 Share Posted October 26, 2006 Here ya go: http://homepage.mac.com/kib/spamcoptool/spamcoptool.html Thanks for the additional information. If you're afraid to download or run the application I'll post the source a bit later today. I did download the file, aplan was to read the included 'Read Me' file. As indicated, popping open the .ZIP revealed only the .dmg files .. there was no 'Read Me' file available .... and no way to break out the code involved on this Windows machine ... thus my actions... Thanks for following up. Link to comment Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.