Re: SpamCop script which worked in Tiger suddenly dropping some attachments in Leopard
Re: SpamCop script which worked in Tiger suddenly dropping some attachments in Leopard
- Subject: Re: SpamCop script which worked in Tiger suddenly dropping some attachments in Leopard
- From: Alex Zavatone <email@hidden>
- Date: Sun, 06 Feb 2011 18:32:51 -0600
I'm using one from Knujon.org.
If you want it, I'll email it to you.
Cheers,
- Alex
On Feb 6, 2011, at 4:58 PM, Kok-Yong Tan wrote:
> I picked up a script that basically takes selected spams, processes them by expanding them with full headers to a folder on my desktop, attaches each of them to an email and sends them to a quick reporting address at spamcop.net. This used to work fine in Tiger Mail but did so very slowly. Now that I'm using the same script on Leopard (10.5.8) Mail, it works much faster (maybe an order of magnitude) but periodically (not always), it'll drop attachments. By this, I mean that if there were say, 8, attachments, it'll only attach the first to the third, drop the fourth to the seventh and attach the eighth to the email. Usually when Apple Mail is busy downloading new mail but sometimes when Apple Mail is seemingly idle according to the Activity window. I then have to manually attach the missing fourth to seventh attachments. Can anyone tell me why a script that worked perfectly in Tiger is now behaving like this in Leopard? Can anyone tell me how to fix it? Since it doesn't crash, it doesn't quite highlight in the Script Editor debugging window as to what the problem is. I've tried making it a standalone app as well as adding a delay of 2 to 3 seconds at the attachment section of the Applescript but neither seems to have helped. It can occur with 20 emails. It can occur with 5 emails. The dropouts seem to be very random.
>
> (* SendToSpamCop V1.0
> written by S.J.L. v/d Velden
> The code below is open source and you may freely edit and redistribute it.
> Though I would appreciate it if you gave credits to the original author (me).
> --------------------------------------------------------
>
> You have to customize a variable to make this Applescript
> work with your SpamCop account.
>
> Below you see the line that begins with "set
> SCaccount to..."
> Replace the text YOURACCOUNT with the email address
> you got from SpamCop.net to forward your spam to.
>
> Script further modified by Kok-Yong Tan:
> Added capability to clean out attachment processing folder before next use
> Added a specification for a SENDINGACCOUNT when multiple email accounts are present in Apple Mail
> Added a tally to be inserted into the subject line
> *)
> --
>
> set SCaccount to "YOURACCOUNT"
>
>
> (* Below is the rest of the sourcecode of the Applescript.
> Please be very careful when editing this code *)
>
> -- Create a SpamCop folder on the desktop
> set theOutputFolderPath to path to desktop folder
> set theNewFolderName to "SpamCop"
>
> tell application "Finder"
> if (exists folder (theOutputFolderPath & theNewFolderName as string)) = false then
> make new folder at desktop with properties {name:theNewFolderName}
> else
> delete every item of folder (theOutputFolderPath & theNewFolderName as string)
> end if
> end tell
>
> -- Create a new message in mail addressed to the users SpamCop account. Read the source from the selected messages in mail and save it as SpamCop readable file in the newly created SpamCop folder. Then attach each file to the new message.
> tell application "Mail"
> set theMessages to the selection
> set counter to 0
> set totalSize to 0
> set theMessage to (make new outgoing message with properties {visible:true, content:" ", sender:"SENDINGACCOUNT"})
> repeat with thisMessage in theMessages
> set counter to counter + 1
> set sourceFile to ((theOutputFolderPath & theNewFolderName as string) & ":ml" & counter & ".src")
> set thisSource to the source of thisMessage as string
> set totalSize to totalSize + (message size of thisMessage)
> set f to open for access sourceFile with write permission
> set eof of f to 0
> write thisSource to f
> close access f
>
> tell "Finder"
> set theAttachment to sourceFile as alias
> end tell
>
> tell the theMessage
> tell content
> make new attachment with properties {file name:theAttachment} at after last character
> end tell
> end tell
>
> delete thisMessage
>
> end repeat
>
> -- Address it at the end just in case script crashes midway so there'll be some indication and add a tally of junk being reported
> tell theMessage
> make new to recipient at end of to recipients with properties {address:SCaccount}
> set subject of theMessage to ((counter) & " junk item(s) being submitted for processing; total size is around " & (round (totalSize / 1024)) & "KB" as string)
> end tell
>
> end tell
> --
> Reality Artisans, Inc. # Network Wrangling and Delousing
> P.O. Box 565, Gracie Station # Apple Certified Consultant
> New York, NY 10028-0019 # Apple Consultants Network member
> <http://www.realityartisans.com> # Apple Developer Connection member
> (212) 369-4876 (Voice) # My PGP public key can be found at <https://keyserver.pgp.com>
>
>
>
>
> _______________________________________________
> Do not post admin requests to the list. They will be ignored.
> AppleScript-Users mailing list (email@hidden)
> Help/Unsubscribe/Update your Subscription:
> Archives: http://lists.apple.com/archives/applescript-users
>
> This email sent to email@hidden
_______________________________________________
Do not post admin requests to the list. They will be ignored.
AppleScript-Users mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
Archives: http://lists.apple.com/archives/applescript-users
This email sent to email@hidden