Yahoo! Inc. Customer Data Security Breach Litigation Settlement
That email Yahoo sent you is legit. If you had a Yahoo account between 2012 and 2016, you could be eligible for a settlement claim as the result of a data hack.
The email platform suffered major security breaches during 2013-2016, which means your email could've been hacked and your personal information stolen.