• 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
message reply content
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

message reply content


  • Subject: message reply content
  • From: James Roberts <email@hidden>
  • Date: Tue, 08 Nov 2011 07:31:45 -0500

Could really use some help understanding this. Sure I am missing something fundamental here

I have a script that acts on incoming mail and if the action errors out sends a reply email.

		tell application “some application"
			try
				do somehting
			on error
				tell application "Mail"
					set errorMsg to reply thisMsg
					set content of errorMsg to errorContent
					send errorMsg

				end tell

The problem is setting the content is completely unreliable. Sometimes it works, most times it does not. I did up the following script to see if I could figure out what was going on. I can’t :-( the first run the newContent was prefixed to content. On the second run content shows empty.

I apologize if this has been discussed before, the archives seem to be down.

set newContent to "this is reply content"
tell application "Mail"
	set messagesList to selection
	set the message_cout to the count of messagesList
	repeat with i from 1 to count of the messagesList
		set theMsg to item i of messagesList
		set origFrom to sender of theMsg
		set origTo to (address of item 1 of recipient of theMsg as string)
		set origContent to content of theMsg
		set errorMsg to reply theMsg -- with  opening window	just to make sure
		-- set properties of errorMsg to {content:newContent} -- tried this
		set content of errorMsg to newContent
		set replyFrom to sender of errorMsg
		set replyTo to address of item 1 of recipients of errorMsg
		set replyContent to content of errorMsg
		-- send errorMsg
	end repeat
end tell


Run one:

tell application "Mail"
	get selection
		--> {message id 26033 of mailbox "INBOX" of account "Gmail"}
	get sender of message id 26033 of mailbox "INBOX" of account "Gmail"
		--> "James Roberts <email@hidden>"
	get address of item 1 of recipient of message id 26033 of mailbox "INBOX" of account "Gmail"
		--> "email@hidden"
	get content of message id 26033 of mailbox "INBOX" of account "Gmail"
		--> "http://growl.info/documentation/applescript-support\n\n\nJimmy Roberts\n\nFreedom is often simple ignorance of whom you serve.\n—The Cynic’s Book of Wisdom\n\nSent from my iP?d"
	reply message id 26033 of mailbox "INBOX" of account "Gmail"
		--> outgoing message id 85
	set content of outgoing message id 85 to "this is reply content"
	get sender of outgoing message id 85
		--> "James Roberts <email@hidden>"
	get address of item 1 of every recipient of outgoing message id 85
		--> "email@hidden"
	get content of outgoing message id 85
		--> "this is reply content\n\nOn 07-11-2011, at 20:32 , James Roberts wrote:\nhttp://growl.info/documentation/applescript-support\n\n\nJimmy Roberts\n\nFreedom is often simple ignorance of whom you serve.\n—The Cynic’s Book of Wisdom\n\nSent from my iP?d
end tell

Run two:

tell application "Mail"
	get selection
		--> {message id 26033 of mailbox "INBOX" of account "Gmail"}
	get sender of message id 26033 of mailbox "INBOX" of account "Gmail"
		--> "James Roberts <email@hidden>"
	get address of item 1 of recipient of message id 26033 of mailbox "INBOX" of account "Gmail"
		--> "email@hidden"
	get content of message id 26033 of mailbox "INBOX" of account "Gmail"
		--> "http://growl.info/documentation/applescript-support\n\n\nJimmy Roberts\n\nFreedom is often simple ignorance of whom you serve.\n—The Cynic’s Book of Wisdom\n\nSent from my iP?d"
	reply message id 26033 of mailbox "INBOX" of account "Gmail"
		--> outgoing message id 86
	set content of outgoing message id 86 to "this is reply content"
	get sender of outgoing message id 86
		--> "James Roberts <email@hidden>"
	get address of item 1 of every recipient of outgoing message id 86
		--> "email@hidden"
	get content of outgoing message id 86
		--> ""
end tell










 _______________________________________________
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

  • Follow-Ups:
    • Re: message reply content
      • From: Christopher Stone <email@hidden>
  • Prev by Date: Re: Burning DVD's
  • Next by Date: javascript
  • Previous by thread: Re: AppleScript-Users Digest, Vol 8, Issue 510
  • Next by thread: Re: message reply content
  • Index(es):
    • Date
    • Thread