Church fathers used their reason and logic to decide which letters and gospels were authentically canonical, and which were apocryphal or pseudepigrapha.
Even this kind of inspiration or mediated revelation is subject to mistake by fallible humans. It is almost universally acknowledged today by religious scholars that at least three of Paul's epistles weren't written or dictated by him, and of the 13 Pauline letters only seven are unambiguously authored by Paul.
The inauthentic Pauline epistles are stuck in the New Testament canon because we are not going to change the canon at this point.