SAN FRANCISCO — Yahoo Inc. has agreed to settle a class action challenging the way the company analyzes email messages to serve targeted ads to users of its popular Yahoo Mail service.

The deal, outlined in court papers filed Thursday evening, would settle claims brought on behalf of non-Yahoo subscribers who claimed their messages were intercepted, scanned and stored as part of communications with Yahoo Mail users. The settlement is subject to approval from U.S. District Judge Lucy Koh who has been overseeing In re Yahoo Mail Litigation, 13-4980.