Auto reply & redirect e-mail rules: both at same time?

  1. My apologies. I’m brand-spankin’ new to scripting and in way over my head.
  2. Search results not too good. What I am trying to do is probably too simple to have been covered on this bbs.

I am changing ISPs. I would like to automatically reply to any incoming mail from the old ISP, advising the sender of the new e-mail address. I would then like to forward the same e-mail to my new e-mail address, and lastly, delete the message sent to the old address from my inbox entirely.

When I tried this using the OSX mail client, it was either/or. Could not both reply and forward under the same rule.

So now I’m thinking that scripting may be the only option. But after a couple hours with online script tutorials and web sites, it looks like it will take many days of dedicated study to get even a rudimentary understanding of the concepts, commands, data types, etc… I’m not that young anymore!

What say the Sages?

Threw this together really quick. Try it out. Set it as the result of a rule set to identify old isp emails.

property ReplyMessage : "Autoreply: This isn't my current email address. I've left the sinking ship for greener pastures. With better bandwidth. And speeds. And cheese. You get the picture."
property newAddress : "cheese@pizza.com"


using terms from application "Mail"
	on perform mail action with messages theMessages for rule theRule
		set theNewMessage to make new outgoing message with properties {subject:("RE: " & subject of theMessage), visible:false}
		tell theNewMessage
			make new to recipient at end of to recipients with properties {address:(reply to of theMessage)}
			set content to ReplyMessage
			send
		end tell
		tell theNewMessage
			make new to recipient at end of to recipients with properties {address:newAddress}
			set content to ReplyMessage
			send
		end tell
		delete theMessage
	end perform mail action with messages
end using terms from

Marvelous! Thank you Fistoprince.

I’m afraid the last time I felt comfortable with coding was with something called Waterloo Fortran IV. This is why we now have structured languages and GUIs!

TCK