Forwarding last read email ......


New to AppleScript and I have searched for an answer and code example to no avail. Hopefully someone here can point me in the right direction.

I would like to use a rule in Apple Mail to forward the last retrieved (not read or selected) email, based on specific criteria. Essentially, I am looking to create a trigger mechanism for every email that gets retrieved into Apple Mail where the email will be analyzed for specific criteria (sender email address, recipient email address, and email account, although this may be redundant with recipient email address).

Most if this can be done very easily with an Apple Mail Rule, with one exception: I need to send it from a different email account (defined in Apple Mail) from the account in which it was received. This requirement is what has me looking at a possible AppleScript solution.

I think my sticking point is that everything I have tried, based on examples I have been able to find, expects the action to be performed on the currently selected email in Apple Mail. I would like this action to occur without any intervention from the user, but when an email is retrieved into Apple Mail (Get Mail).

Any ideas how I can get this to work?



Sorry - Subject of post should be “Last retrieved email”, not “Last read email” …


Hi Michael,

The problem with manipulating email in Mail, is that you don’t have a references to the new messages. It’s a bug or a feature (for security) that Apple introduce in their newer systems. i.e. if you don’t have a reference to the message, then you can’t get info on them.

What you need to do is move the messages to another mailbox or read them.

In another post, my workaround was to move the message to something like a temporary mailbox. Then, you can get info on them. I think this is what you’re trying to do.

Unless you do something with the incoming mail there is nothing you can do with it unless Apple fixed Mail in Yosemite’s updates.



One more thing. You should change the name of your temporary email folder every month at least.