Smart Attachments (a paid add-on) looks like it should do that and more. One of the bullet points from the overview:
Disclosure! We're friends with the guys at Stiltsoft, and that's how I happen to know of this particular plugin, but I haven't used it personally.
Hey Community mates! Claire here from the Software Product Marketing team. We all know software development changes rapidly, and it's often tough to keep up. But from our research, we've found the h...
Connect with like-minded Atlassian users at free events near you!Find a group
Connect with like-minded Atlassian users at free events near you!
Unfortunately there are no AUG chapters near you at the moment.Start an AUG