Mail rule for RSS articles -- is this possible?

Hi,

I’m using Mail to subscribe to RSS feeds and I’d like to set up a rule to trigger an AppleScript when certain articles arrive. I can get the rule to trigger, but the AppleScript doesn’t seem to do anything. I found a script on this board that looked like it would be good for debugging this problem. It looks something like this:

using terms from application "Mail"
	--on perform mail action with messages theMessages
	set debug to true
	if debug is true then say "starting"
	set ptd to my SetFolder()
	if debug is true then say "have folder"
	tell application "Mail" to set theMessages to (get selection) --for testing
	tell application "Mail" to repeat with theMessage in theMessages -- loop through the messages sent by Mail
		set theText to (get theMessage's source) -- retrieve message body
		if debug is true then say "got contents"
		--delay 2
		set theFile to ptd & "Things to Do " --& (theMessage's id as string) -- create file name
		if debug is true then say "set name"
		set theFileID to open for access file theFile with write permission -- open the new file for writing
		
		if debug is true then say "open file"
		write theText to theFileID -- write the body text of the current email into the new file
		close access theFileID -- close the file
		
		if debug is true then say "closed file"
	end repeat
	--end perform mail action with messages
end using terms from

to SetFolder()
	set ptd_handler to ((path to desktop folder) as Unicode text)
	return ptd_handler
end SetFolder

I’ve commented out the “perform mail action” and I’m trying to act on the messages that are selected in Mail. I’m only doing this to let me run in Script Editor. When I do that, I get an error that says “Mail got an error: Can’t get account “RSS”.”

It’s hard to tell exactly where this happens, but I’m guessing it’s when I do (get theMessage’s source). Does this mean that I can’t do anything useful with AppleScript + RSS? I have a workaround, but I really don’t like it. Right now, I’m forwarding the RSS article to my email, triggering the script on the email, and deleting it when it’s done. I really hope there’s a better solution than that.

Thanks for the help :slight_smile:

Hi Elron,

As far as I know, you currently cannot access Mail’s RSS feeds via integrated AppleScript commands, Mail doesn’t support this right now. Maybe the next version will.

Bummer. I guess I’ll have to set up another free mail account so I can spam it with forwarded RSS articles :slight_smile:

Thanks for the reply.