Jump to content

For Mac users: automatic reports with Applescripts


frenchkiwi

Recommended Posts

I'm trying to make an AppleScript that when run, takes all selected emails, forwards them to Spamcop, then deletes them. And that part of the puzzle works. It actually works great, its very fast, sends all the messages and doesn't leave a trace. Once they are gone, is when I start to have the problems. I used the "source of message" property to take the raw source of the spam, and make it the body of a new email. I've sent it to myself too, and as far as I can tell, the emails that are being sent out look fine. The email looks just like the same source that I'd copy and paste into the spamcop web site, and doing that works. But using my scri_pt gives me the error:

error: couldn't parse head

Message body parser requires full, accurate copy of message

It lets me view the full message and it looks fine. Any idea what the problem is, just what is it that spamcop doesn't like about my messages? I just tested manually copying the raw source and pasting that into a new email, and sending it to spamcop. That also didn't work. I get the same errors. Though when I view the message, it looks totally normal. I also tried using the applescript to set the content of the new email to the headers of the spam, then a few returns, then the body of the email, but that also doesn't work. Same old error message. As a final resort, I just had my scri_pt make up the reporting email using the raw source as the content, and I manually switched it over to "Make Plain Text" before sending the email. Still got the same old problem.

Here is a pastebin clipping of my last email, that Spamcop wouldn't parse:

http://pastebin.com/825373

here is a pastebin of that same email's source pasted directly into the SpamCop web site and properly parsed by the system:

http://pastebin.com/825376

Both clippings are taken from SpamCop's "View full message" option you get after you initially send it spam.

After looking at the two myself, it looks like somewhere along the line, my emails are getting line-wrapped. So I just send another email to spamcop, by manually copying the raw source and then pasting it into a new email, only this time, I switched it to Plain Text (from Rich Text) BEFORE I pasted the source in there. And that seems to have solved the problem.

As you can probably tell I'm writing this as I work on the scri_pt.

So I guess my only question is, how can I make a new email using AppleScript and Mail.app, and have it be Plain Text by default, instead of Rich Text by default?

Link to comment
Share on other sites

OK I have an update. I figured out how to send emails as plain text, but the lines are still getting wrapped. I made absolutely sure that the emails this scri_pt is sending are plain text and they are. That one that worked must have been a fluke, because none of these others are working. The lines are NOT wrapped in the new mail window before the mail is sent, somewhere along the way it is getting wrapped. I suppose as a last resort, I could try sending emails through the command line. But that won't be fun.

Link to comment
Share on other sites

  • 3 weeks later...

Any chance we could see the source for SpamCop Tool.scpt?

It would be nice if I could edit 2 things, either in the scri_pt, or the Preferences.... the size of the window it's opening, currently it's too small and I end up scrolling a lot... and if it could open in my default browser (Firefox).

Thanks.

Link to comment
Share on other sites

It would be nice if I could edit 2 things, either in the scri_pt, or the Preferences.... the size of the window it's opening, currently it's too small and I end up scrolling a lot... and if it could open in my default browser (Firefox).

I've made the window larger. I'll see if I can get this into the preferences.

The scripts are in the application package, show the package content and go to Contents/Resources/Scritps.

A new version is available:

http://homepage.mac.com/kib/spamcoptool/spamcoptool.html

Link to comment
Share on other sites

I've made the window larger. I'll see if I can get this into the preferences.

The scripts are in the application package, show the package content and go to Contents/Resources/Scritps.

A new version is available:

http://homepage.mac.com/kib/spamcoptool/spamcoptool.html

:D Thanks... I honestly wasn't expecting you to change it yourself... but, I definitely appreciate the work!

Very useful tool...

Link to comment
Share on other sites

I've made the window larger. I'll see if I can get this into the preferences.

The scripts are in the application package, show the package content and go to Contents/Resources/Scritps.

A new version is available:

http://homepage.mac.com/kib/spamcoptool/spamcoptool.html

I should say that I'll work these changes into the next version, the current version still has the same small browser window as well as Safari as the hard-coded browser.

Watch this space.

Link to comment
Share on other sites

  • 1 month later...

Hi ,

How about that scri_pt by RK-hatez-spam , does it work , is it any good , does it need configuration ? Is there a homepage for it & / or why ain't it on scriptbuilders.net.

All the other sc_ripts on scriptbuilders.net are for other Mail clients then the default Mail.app included in OS X - they might even be for OS 9 versions of those apps & might or might not been updated for OS X . Anyway they aren't written for Mail.app but for Eudora , Entourage (OS X) & Outlook Express (OS9 - Classic).

I have also downloaded the Spamcoptool from Kiberkly & am looking in to test it. However i wonder why didn't this software made a place in the software listings of Macupdate.com, versiontracker.com & even not the Apple.com downloads page. Cause all these places is where i & i suppose most Mac users search for software

Link to comment
Share on other sites

I tried this Spamcoptool from Kimberly .

Well it doesn't seem to work , the app ran & interacted with mail but my reports wasn't send to spamcop nor did i get mails from spamcop to process the reports. My reports weren't listed on my spamcop.net page neither so i must conclude the app never send them in.

There should really be a thread that offers a (or a few) working solutions

Link to comment
Share on other sites

There should really be a thread that offers a (or a few) working solutions

This is probably that thread and if you find some, please update it. Then it can be added to the FAQ here at least. Since there are no applications provided by spamcop, it is up to third parties to provide these things.

Link to comment
Share on other sites

  • 3 weeks later...

I tried this Spamcoptool from Kimberly .

You must mean kiberkli. :)

Well it doesn't seem to work , the app ran & interacted with mail but my reports wasn't send to spamcop nor did i get mails from spamcop to process the reports. My reports weren't listed on my spamcop.net page neither so i must conclude the app never send them in.

See if you can find out if outgoing connections to port 25 are blocked on your network or ISP. I have this 'problem' at home with SBC/at&t or whatever it is at the moment.

From the SpamCop Tool web page:

SpamCop Tool will not work if it does not have SpamCop reporting email address or if it can't find the UNIX mail command. In addition port 25 may not be blocked or otherwise filtered. If your ISP or network administrator blocks port 25 for outbound connections you may not be able to use this tool to report spam.

Hope this helps.

(Mac Mail hard-wraps the spam message headers when it shouldn't. Mac Mail is not my preferred vehicle to send reports.)

Link to comment
Share on other sites

You must mean kiberkli. :)

Sorry , honestly , if you see my previous post , you'll see this typo only happened once

See if you can find out if outgoing connections to port 25 are blocked on your network or ISP. I have this 'problem' at home with SBC/at&t or whatever it is at the moment.

From the SpamCop Tool web page:

SpamCop Tool will not work if it does not have SpamCop reporting email address or if it can't find the UNIX mail command. In addition port 25 may not be blocked or otherwise filtered. If your ISP or network administrator blocks port 25 for outbound connections you may not be able to use this tool to report spam.

Yes this seems the problem, My provider & all other providers here block port 25 cause we can't run hour own mail server, is there a way to use another (non standart port) or to use the smtp server from my provider (you need to add a way to change these in the apps preferences i think).

There is no way that my provider will open port 25, they state that very well :(

(Mac Mail hard-wraps the spam message headers when it shouldn't. Mac Mail is not my preferred vehicle to send reports.)

Is this a problem for your application, i hope not cause i use Mail as default Mail program & feel no need to change this.

Well as i stated in another post on the forum; I still can use the subsume Spamcop Mail plugin dunno how, but suddently by removing & adding the plugin again to Mail it started working again) So atm i'm save on my G4 Mac but when i replace this with a Core 2 (3) Duo Mac later this year i might (will) ber into trouble.

Rosetta only works on applications (& all plugins used in this applications) it wont work directly on th plugin. Mail would be x86 only so i wouldn't be able to start Mail using Rosetta & if possible doing so wouldn't solve a thing but only postpone the problem.

I dunno how this spamcop plugin is violating spamcop other then using it's name, but so does kiberkli, so i guess it must be the absence of the word "mail plugin" in the name of the plugin. Maybe you, Kiberkly or other programmers, needs to get the source from Subsume & fix this plugin, make it Universal Binary & make it honor spamcop.net (hell if you dislike Mail, you might want to use this to make a Thunderbird-Correo plugin - i'll use the one for Mail though as Mail pleases me enough)

Link to comment
Share on other sites

Yes this seems the problem, My provider & all other providers here block port 25 cause we can't run hour own mail server, is there a way to use another (non standart port) or to use the smtp server from my provider (you need to add a way to change these in the apps preferences i think).

The application uses the UNIX mail command and I have not figured out how to get it to use another port. You would also have to have a mail server that can listed to that same port.

There is no way that my provider will open port 25, they state that very well :(

Is this a problem for your application, i hope not cause i use Mail as default Mail program & feel no need to change this.

I have the same issue with my ISP. I only report spam at work where I own the mail server.

I'll look at sending the spam messages to spamcop in the form of attachments, which spamcop is suppose to be able to do, but I never got to work (on my end - the attachments get uuencoded).

Link to comment
Share on other sites

  • 2 months later...

There is no way that my provider will open port 25, they state that very well :(

Is this a problem for your application, i hope not cause i use Mail as default Mail program & feel no need to change this.

Ok, you can now use your account in the Apple Mail app. You no longer need port 25 open - Make sure you edit the preferences and choose Mail and not UNIX Mail Command

I have moved the download page for the SpamCop Tool:

http://www.eskimo.com/~kiberkli/spamcoptool/

The tool now also opens the URLs in your default browser.

Link to comment
Share on other sites

  • 3 months later...
Ok, you can now use your account in the Apple Mail app. You no longer need port 25 open - Make sure you edit the preferences and choose Mail and not UNIX Mail Command

I have moved the download page for the SpamCop Tool:

http://www.eskimo.com/~kiberkli/spamcoptool/

The tool now also opens the URLs in your default browser.

Hi, kiberkli. Thanks for writing this. It seems to work well, with a minor issue. I have it set up to use OS X mail, and it is sending the messages (they appear in my Sent folder) and the mail server shows them being delivered to spamcop, but I never get the replies from SpamCop.

Is this an attachment type problem?

Here's the raw message format

Mime-Version: 1.0 (Apple Message framework v752.2)

To: submit.<snip>spamcop-id</snip>[at]spam.spamcop.net

Message-Id: <85FC5F80-56EB-41B8-90E2-C461EC650110[at]svcolo.com>

Content-Type: multipart/mixed;

boundary=Apple-Mail-43--12194711

From: Jo Rhett <jrhett[at]svcolo.com>

Subject: spam Report

Date: Wed, 8 Aug 2007 12:21:59 -0700

--Apple-Mail-43--12194711

Content-Transfer-Encoding: 7bit

Content-Type: text/plain;

x-mac-type=54455854;

x-unix-mode=0644;

x-mac-creator=74747874;

name=spam-1.txt

Content-Disposition: attachment;

filename=spam-1.txt

(contents of spam message here)

Link to comment
Share on other sites

Do you know if the e-mail is actually going out? Although public-wireless.sv.svcolo.com is not in the list of known ISPs that block anything going out that looks like spam, the "public-wireless" does seem to suggest that those folks would want to be pretty tight about outgoing traffic from their system. See the SpamCop FAQ for the entry on ISP's blocking your outgoing e-mail.

Link to comment
Share on other sites

Do you know if the e-mail is actually going out? Although public-wireless.sv.svcolo.com is not in the list of known ISPs that block anything going out that looks like spam, the "public-wireless" does seem to suggest that those folks would want to be pretty tight about outgoing traffic from their system. See the SpamCop FAQ for the entry on ISP's blocking your outgoing e-mail.

As I stated,

I have it set up to use OS X mail, and it is sending the messages (they appear in my Sent folder) and the mail server shows them being delivered to spamcop

So yes, it is delivered to the mail server and the mail server log shows that it was received by vmx1.spamcop.net.

Aug 8 11:07:31 kininvie sm-mta[34716]: l78I5lYn034556: to=<submit.*snip*[at]spam.spamcop.net>, delay=00:00:00, xdelay=00:00:00, mailer=esmtp, pri=33993, relay=vmx1.spamcop.net. [204.15.82.27], dsn=2.0.0, stat=Sent (ok: Message 1842541492 accepted)

And public-wireless is just what I named the netscreen firewall, of which I am the administrator. It doesn't interfere with any non-attack-style traffic at all.

Do you know if the e-mail is actually going out?

And just to be extra-special-clear, if I manually use CMD-OPTION-U to view the raw source and then forward that to the listed spamcop address it works fine. So mail flow from my workstation to spamcop is just fine.

There's something about the attachment style used by this plugin that isn't working.

Link to comment
Share on other sites

  • 2 months later...

I'm using SpamCop Tool to report spam to SpamCop. You can find it at:

http://www.eskimo.com/~kiberkli/spamcoptool/

It works with OS X 10.4.10 and Apple Mail.app. It watches your Junk folder in Mail and asks if you want to forward them all to your SpamCop reporting address, which you must set up first. If so, it will gather up all the emails into one email that is suitable for SpamCop to process.

It seems to work -- at least, I've seen it working properly for me -- but recently I've not had any response emails back from SpamCop, and no recent reports are listed in my account.

I've checked the specific reporting email for my account and re-entered it into SpamCop tool, but still no response.

Any suggestions?

Link to comment
Share on other sites

Any suggestions?

Poster over in the newsgroups yesterday looked at the troubleshooting steps laid out 'here' in the SpamCop FAQ and came up with that the ISP involved is blocking outgoing 'spam' .... he tried an alternate e-mail host and found that they are blocking outgoing also .....

Link to comment
Share on other sites

Poster over in the newsgroups yesterday looked at the troubleshooting steps laid out 'here' in the SpamCop FAQ and came up with that the ISP involved is blocking outgoing 'spam' .... he tried an alternate e-mail host and found that they are blocking outgoing also .....

Or it could be that my email response address preference in SpamCop as still set to an old and now defunct email account? Doh! :blush:

Link to comment
Share on other sites

  • 3 months later...

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...