This article is more than
8 year oldReuters news agency says the firm built special software last year to comply with a classified request.
"Yahoo is a law abiding company, and complies with the laws of the United States," the tech firm said in a statement provided to the BBC.
The allegation comes less than a fortnight after Yahoo said hackers had stolen dataabout many of its users.
Yahoo is in the process of being taken over by Verizon Communications in a $4.8bn (£3.8bn) deal. The telecoms provider declined to comment on the report.
Reuters reports that the scans were requested by either the National Security Agency (NSA) or the FBI, according to three sources - two of whom it says were ex-Yahoo employees.
The news agency says that the software scanned for a string of characters within all incoming emails, but adds that it was unable to determine what information was handed over or if other internet companies had received a similar demand.
US law allows the country's intelligence agencies to order the release of customer data that they believe could prevent a terrorist attack, among other reasons.
Companies can challenge such orders behind closed doors in the Foreign Intelligence Surveillance Court.
But Reuters reports that Yahoo decided not to fight the matter because it thought it would lose. It adds that some Yahoo employees were upset by that decision.
The whistleblower Edward Snowden, who previously revealed details about the US's cyber-spying efforts, has tweeted in response to the unverified allegations: "Use @Yahoo? They secretly scanned everything you ever wrote... close your account today."
Newer articles