• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag
 

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Mail Action Message Source Encoding Difficulty
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Mail Action Message Source Encoding Difficulty


  • Subject: Mail Action Message Source Encoding Difficulty
  • From: Alex Sauer-Budge <email@hidden>
  • Date: Thu, 30 Jan 2003 10:55:32 -0500
  • Resent-date: Thu, 30 Jan 2003 22:16:22 -0500
  • Resent-from: Alex Sauer-Budge <email@hidden>
  • Resent-message-id: <email@hidden >
  • Resent-to: email@hidden

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:040000008200E00074C5B7101A82E00800000000D04CF93973C3C201000000000000 000
010000000A472B3AEDA5F564AAAD488B35A3B47DC

but when I write the text to a file with AppleScript from inside a mail action handler, the resulting file contains

UID:040000008200E00074C5B7101A82E00800000000D04CF93973C3C201000000000000
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.

  • Prev by Date: Re: Photoshop opening file
  • Next by Date: introspection questions
  • Previous by thread: Mail Action Message Source Encoding Difficulty
  • Next by thread: HELP-> desktop area, positioning
  • Index(es):
    • Date
    • Thread