It is illegal to open a deceased person's mail, unless you're an appointed executor or legal representative of the state.
Or if you're a close family member or son, daughter, spouse, etc then you could open the deceased persons mail without any issue.
But if it's someone else's mail and you don't know them or are not related to the deceased person it would be illegal to open their mail.
If you get mail in a deceased person's name and you're not related to them or not the legal representative then you should not open it.
Instead write "Deceased, Return to Sender" on the envelope or mail and leave it for the postal carrier or drop it off at the post office.
Inform the post office and if you're an executor, you can file a request at the post office to stop mail delivery for the deceased person or redirect it.
And for mail like subscriptions, you can also contact the company directly and inform them of a person's death.
Another thing you can do is register on the deceased do not contact list, which is an optional step that you can take to help reduce junk mail being sent to the deceased.
If you're the legal representative of the deceased person you do have the authority to open the deceased persons mail or also if you're the executor or the administrator of the estate.
The law is also strict about opening of mail that doesn't belong to you, even if you have no malicious intent.
Although if you lived with the person, you can still manage the deceased person's mail the same as you did when they were alive.
But to legally open and handle it you really have to be appointed the executor.
But in some cases, nothing will happen if you open the deceased persons mail and read it or throw it away if it really is not needed.
I still get some of my sister's mail and she died at 40 years old 3 years ago.
Most of it is just junk mail and so I open it and look at it and then dispose of it.