Become a MacRumors Supporter for $50/year with no ads, ability to filter front page stories, and private forums.

drivebyed

macrumors newbie
Original poster
Sep 22, 2010
4
0
London, UK
Hi All,

Bit new here and my coding is ropey at best. Basically ive got some automated emails that appear in my inbox every 10 mins or so. They have the same subject but different contents. What I want to do is, when the emails come in to take the first line of it then send a new email with the first line as the subject.

So what ive done is to write an applescript which gets triggered on a subject line rule. The script is as follows:

Code:
using terms from application "Mail"
	on perform mail action with messages theMessages for rule theRule
		set recipientAddress to "example@com.com"
		tell application "Mail"
			repeat with thisMessage in theMessages
				set theText to paragraph 1 of content of theMessage
				set theNewSubject to "!-- some text --!" & theText
				set theNewMessage to make new outgoing message
				tell theNewMessage
					make new to recipient at end of to recipients with properties {address:recipientAddress}
					set subjext to theNewSubject
					set content to theText
				end tell
				delay 5
				send theNewMessage
				tell thisMessage
					set replied to true
				end tell
			end repeat
		end tell
	end perform mail action with messages
end using terms from

Any help would be much appreciated. As i said earlier not even registering in the console and nothing seems to happen.

Thanks.
 
I put the script you linked into the rule and the rule is defiantly triggering. It doesnt then seem to be executing my script. I am going to try putting the script you linked into mine and see if it still triggers.

Thanks
 
Okay after some testing it looks like
Code:
paragraph 1 of content
is no longer supported and is breaking the script - is there an alternative? This is really the most important part.
 
Register on MacRumors! This sidebar will go away, and you'll see fewer ads.