Automatically mark Junk mail as read
For Junk Mail, you can create a Rule. From the menu bar item “Mail”, select > Preferences > Rules > Add Rule. Make a rule with the following conditions:



For Trash, you can simply bypass Mail’s Trash and rely on the server settings of the email account. To do so, from the “Mail” menu bar item (again) > Preferences > Accounts > [select account] > Mailbox Behaviors > uncheck “Move Deleted Messages To the Trash Mailbox”