Rabbeinu Gershom issued a Cherem (ban) on unauthorized reading of private letters.
I would like to know how books which contain private correspondence or sh'elos us'shuvos between Rabbis and other people are published?
To quote the reasons most relevant to this question
Some formulations of the original herem are phrased "if [the recipient] threw away the letter it is permitted [to read it]"
R Hayim Palaggi states the herem only applies if the letter includes a prohibition to further broadcast it
R Moshe ben Habib felt the sender needed in addition to verbally articulate that the herem applies to his letter, in addition he felt the herem applied only to the one opening the letter, not to one who reads an already opened one -- and so write the Shiltei ha-Gibborim and the Birkei Yosef
ma‘aseh rav: significant precedent is indeed available, i.e., Torah journals, countless memorial volumes for deceased gedolim are publishing private letters and divrei Torah of gedolei Yisrael after their deaths when neither they nor members of their family are available to grant permission. Furthermore, dozens of collections of letters of gedolei Yisrael—including much personal material as well—have been published without permission
Though he does not address the ban directly one may be able to extrapolate from the halakhic argument offered by Rabbi Shlomo Goren in the journal Techumin, vol. 4 pp. 354-360. Here are some of the sources and arguments.
Rav Goren begins with two texts that seems to contradict each other:
The Gemara in Yoma(4b) learns that you may not repeat something that you hear because it says (Lev. 1:1), “Now the Lord called to Moses, and spoke to him from the tabernacle of meeting, saying.” The last word — “saying” (leimor) — seems redundant because the next verse begins with “speak” (dabeir). The Gemara explains that “leimor” teaches us that you have to receive explicit permission in order to repeat something you are told. This is quoted in the Magen Avraham(156:2). Presumably, one would therefore not be allowed to publish a letter without permission.
However, the Tosefta (Bava Kammach. 7) states that someone who “steals” (overhears) someone else’s teachings may go and repeat the teachings. The Shakh(Yoreh De’ah 292:35) rules, based on this, that you may copy Torah insights from someone else’s book even if he doesn’t want you to do so. Therefore, it would seem that one would be allowed to publish a letter of Torah insights without permission.
To explain the contradiction between the above two sources, Rav Goren posits that the Gemara in Yoma was referring to non-Torah related material while the Tosefta deals with Torah. You need permission to tell someone general information you hear. However, Torah belongs to the entire Jewish people. It is something for which we all have a mitzvah to learn and teach. You do not need permission to repeat a Torah insight that you hear from someone else – in fact, doing so is a mitzvah. Therefore, technically you are allowed to publish a letter of Torah insights without permission. However, as a matter of politeness, it is always best to obtain explicit permission.
Source with emphasis added