Re: Mail Action Message Source Encoding Difficulty
Re: Mail Action Message Source Encoding Difficulty
- Subject: Re: Mail Action Message Source Encoding Difficulty
- From: cricket <email@hidden>
- Date: Mon, 3 Feb 2003 12:28:39 -0800
Can you send me the raw source of this message (View->Show-Raw Source)
and a copy of your script?
- cricket
On Friday, January 31, 2003, at 05:15AM, Alexander Sauer-Budge wrote:
How can I obtain the source of a mail message within a mail rule
script so that it "looks like" it does in the message view of Mail--
with the same line breaks?
Details:
I am using an AppleScript with a perform_mail_action handler to
process the source contents on some of my incoming mail with a mail
rule (great feature!). When I view a discrepant message with Mail.app,
everything is as it should be (containing "proper" line breaks), but
when I get the message into AppleScript with a mail rule, the message
source/contents has line breaks that were not there previously. For
example, Mail displays the message as
UID:040000008200E00074C5B7101A82E00800000000D04CF93973C3C20100000000000
0000
010000000A472B3AEDA5F564AAAD488B35A3B47DC
but when I write the text to a file with AppleScript from inside a
mail action handler, the resulting file contains
UID:040000008200E00074C5B7101A82E00800000000D04CF93973C3C20100000000000
0
000
010000000A472B3AEDA5F564AAAD488B35A3B47DC
in which there are additional line breaks. Examining the message
source with Mail or the cached message in ~/Library/Mail/... using
less from the terminal shows that it too is mangled with respect to
the message view in Mail.app.
This appears to be an encoding issue of some sort, but I don't know
how to coerce the "contents of thisMessage" to a string which "looks
like" it does when viewed in Mail.
I would appreciate any insight that can be provided.
Thanks!
Alex
For reference, I've included a simple mail action script which I used
for testing this problem.
on perform_mail_action(info)
tell application "Mail"
set theMessages to |SelectedMessages| of info
repeat with thisMessage in theMessages
set thisSource to the source of thisMessage
display dialog (text 1 thru 12 of (thisSource as text)) as text
try
set thisFile to open for access ,
(choose file name) with write permission
write ((source of thisMessage) as string) ,
to thisFile starting at 0
on error
close access thisFile
end try
close access thisFile
end repeat
end tell
end perform_mail_action
_______________________________________________
applescript-users mailing list | email@hidden
Help/Unsubscribe/Archives:
http://www.lists.apple.com/mailman/listinfo/applescript-users
Do not post admin requests to the list. They will be ignored.
----->
Software Entomologist Mail for Mac OS X
http://www.apple.com/macosx/jaguar/mail.html
---------->
Knives make all other technologies possible and are part of what
defines us as human.
_______________________________________________
applescript-users mailing list | email@hidden
Help/Unsubscribe/Archives:
http://www.lists.apple.com/mailman/listinfo/applescript-users
Do not post admin requests to the list. They will be ignored.