SAN FRANCISCO — A federal judge has rejected Google’s main lines of defense to accusations the company illegally mined personal data from Gmail messages without users’ consent.

In an order issued Thursday, U.S. District Judge Lucy Koh allowed plaintiffs to move forward with claims that Google’s practice of automatically scanning emails to target advertisements violates the federal Electronic Communications Privacy Act and a handful of state privacy laws.