Cabinet noir

In France, the cabinet noir (French for "black room", also known as the "dark chamber" or "black chamber") was a government intelligence gathering office, usually within a postal service, where correspondence between persons or entities were opened and read by government officials before being forwarded to their destination. However, this had to be done with some sophistication, as it was considered undesirable if the subjects of the practice knew about it, and "that the black chamber not interrupt the smooth running of the postal service." This practice had been in vogue since the establishment of postal and telegraphy services, and was frequently used by the ministers of Louis XIII and Louis XIV; but it was not until the reign of Louis XV that a separate office for this purpose was created. This was called the "cabinet du secret des postes", or more popularly the "cabinet noir". Although declaimed against at the time of the French Revolution, it was used both by the revolutionary leaders and by Napoleon.
Outside France.
By the 1700s, cryptanalysis was becoming industrialized, with teams of government cryptanalysts working together to crack the most complex monoalphabetic ciphers. Each European power had its own so called black chamber, a nerve centre for deciphering messages and gathering intelligence. The most celebrated, disciplined and efficient was the Geheime Kabinettskanzlei in Vienna. It operated according to a strict timetable, because it was vital that its activities should not interrupt the smooth running of the postal service. Letters which were supposed to be delivered to embassies in Vienna were first routed via the black chamber, arriving at 7 am. Secretaries melted seals, and a team of stenographers worked in parallel to make copies of the letters. Within three hours the letters had been resealed and returned to the central post office to be delivered to their intended destination. As well as supplying the emperors of Austria with vital intelligence, the Viennese black chamber sold the information it harvested to other European powers. In 1774, for example, an arrangement was made with Abbot Georgel, the secretary in the French embassy, who had access to a biweekly package on information for 1,000 ducats.
Black chambers were also employed by the Dutch Republic.
In 1911, the "Encyclopædia Britannica" took the view that the "cabinet noir" had disappeared, but that the right to open letters in cases of emergency still appeared to be retained by the French government; and a similar right was occasionally exercised in England under the direction of a Secretary of State. In England, this power was frequently employed during the eighteenth century and was confirmed by the Post Office Act 1837; its most notorious use was, perhaps, the opening of Mazzini's letters in 1844.
Such postal censorship became common during World War I. Governments claimed that the total war which was waged required such censorship to preserve the civilian population's morale from heart-breaking news up from the front. Whatever the justification, this meant that not a single letter sent from a soldier to his family escaped previous reading by a government official, destroying any notion of privacy or secrecy of correspondence. Post censorship was retained during the interwar period and afterwards, but without being done on such a massive scale.
The opening of international mail outgoing and incoming from the United States by US Customs under the Trade Act of 2002 occurs under the border search exception to the Fourth Amendment. This practice has had some criticism (including allegations that it adds to the expense of conducting the Postal Service and can thus affect postage rates), of which the USPS apparently informed Congress before passage of the legislation. However, this criticism may be tempered by the fact that the act prohibits agents searching for contraband from reading mail incidentally included in the package or envelope including it, or allowing others to read it. The Intelligence Authorization Act of 2004 has also been characterized as unconstitutionally permitting the opening of domestic mail.