Hakim Al Umma Moulana Ashraf Ali Thanwi (Allah have mercy on him) once mentioned the following:
If an irreligious person speaks of something relating to deen, then his speech will contain some darkness in it. Similarly, his writings will also contain some type of darkness in it. On the converse, if a righteous person speaks of something relating to the dunya, his speech will contain noor in it.
The reason is that in reality, a person’s speech originates from his heart. Hence, a person’s speech will definitely contain the effect of his heart. (If his heart is pure, the effect of the purity will be seen in his speech and writings, and if his heart is impure, then the effect of the impurity will similarly be seen in his speech and writings.)
When this is the situation, that the speaker’s inner condition is reflected in his speech, and the writer’s inner condition is reflected in his writing, then one should understand that it is extremely important for one to refrain from sitting in the company of irreligious people (those who are not committed to deen) and nor should one ever read their writings.
Reading the writings of an author is akin to sitting in his company. Thus, the very same ill-effects which one will experience through sitting in the company of an irreligious person will be found through reading his books or writings.
(Malfoozaat Hakeemul Ummat 23/117)