On my iphone 5, I often delete emails without opening them. When I then work on my Macbook, these emails are marked as unread in the Mail app and, as a result of that, the Mail symbol in the Dock shows a notification. This behavior is confusing. Is there a way to mark an email as read upon moving it to trash? These emails come from different senders, so I cannot create a rule in the Mail app.
One solution could be as follows:
In Macbook, create an Apple script that uploads new emails and marks emails in a given folder as read:
tell application "Mail" check for new mail set read status of messages of mailbox "Deleted Items" of account "XXX" to true end tell
Note that emails that are deleted on iphone do not end up in the Trash but Deleted Items folder in the Mail app on Macbook.
Using the inbuilt Automator on Macbook, create and store an .app that executes the above script.
Use freeware ControlPlane to run the above app upon each log-in. I allowed for a time lag of 10 seconds for the Macbook to establish Internet connection before the app is executed.