A US judge has given the green light to a class-action lawsuit that accuses Yahoo! of illegally violating email users' privacy by scanning the contents of their messages to deliver targeted advertising.

The nationwide suit alleges that the Purple Palace intercepted and parsed the content of emails sent to Yahoo! Mail accounts from non-Yahoo! Mail accounts – including attachments – when the senders hadn't agreed to have their messages snooped in this way.

In addition to scanning messages for spam and malware, Yahoo! also allegedly shared message contents and keywords with its third-party advertising partners, unbeknownst to the message senders.

As a result of these actions, Yahoo! is accused of violating both the federal Stored Communications Act (SCA) and California's Invasion of Privacy Act (CIPA), Reuters reports.

SCA makes it broadly illegal for online services to "knowingly divulge to any person or entity the contents of a communication while in electronic storage by that service," except where users have given explicit permission.

CIPA, meanwhile, prohibits wiretapping without consent, including "attempts to read, or to learn the contents or meaning of any message, report, or communication while the same is in transit or passing over any wire, line, or cable."

In her 44-page decision, Judge Lucy Koh of the US District Court of Northern California scoffed at Yahoo!'s assertion that it would be too hard to figure out consent to the degree the lawsuit demands.

"The Court find's Yahoo's description of the requested injunctive relief as 'setting back email services for decades' to be overly dramatic in light of the evidence in this case," Koh wrote.

She also rejected Yahoo!'s argument that some plaintiffs had implicitly consented to its policies by continuing to send messages to Yahoo! Mail subscribers even after they knew about the scanning activities.

Finally, Koh gave the thumbs-up to class-action status for the suit over Yahoo!'s objections – something she refused to do in a similar case against Google last year – but only in part.

She approved a nationwide class on the Stored Communications Act claims but limited the Invasion of Privacy Act claims to a subclass in California only, because to make it a nationwide class would have required the courts to consider the separate wiretapping laws of all 50 states.

The nationwide class applies to anyone in the US who is not a Yahoo! Mail subscriber but who sent emails to or received emails from a Yahoo! Mail subscriber from October 2, 2011 until the present. The California class, meanwhile, applies to non-Yahoo! Mail subscribers who traded emails with a Yahoo! Mail subscriber from October 2, 2012 to the present.

A verdict in the plaintiffs' favor could be a tough blow for the Purple Palace. According to Yahoo!'s latest annual report, in calendar year 2014 it earned 79 per cent of its total revenue from search and display advertising, and better targeting is generally thought to be the key to wringing more money out of the ads business. ®