Praise be to Allah.
Al-Bukaari and Muslim narrated from Ibn ‘Abbas (may Allah be pleased with him) that the Prophet (peace and blessings of Allah be upon him) said, relating from his Lord, may He be glorified and exalted: “Allah decreed good deeds and bad deeds, then He explained that. Whoever thinks of doing a good deed then does not do it, Allah will write it down as one complete good deed. If he thinks of doing a good deed and then does it, Allah [may He be glorified and exalted] will write it down between ten and seven hundred fold, or many more. If he thinks of doing a bad deed then he does not do it, Allah will write it down as one complete good deed, and if he thinks of it then does it, Allah will write it down as one bad deed.”
Al-Hafiz Ibn Hajar said in Fath al-Bari.
This indicates that the angel can see what is in the heart of the human being, either because Allah informs him of it or because Allah has granted him some knowledge by means of which he is able to find it out.
The former view is supported by the report narrated by Ibn Abi’l-Dunya from Abu ‘Imran al-Jawni who said: He calls out to the angel: “Write down such and such for so and so”, and he says: “O Lord, he did not do it”. He says: “He intended it”.
And it was said that the angel detects a foul odour when a person is thinking of doing a bad deed, and he detects a good smell for a good deed. That was narrated by al-Tabarani from Abu M’ashar al-Madani. A similar report was narrated from Sufyan ibn ‘Uyaynah.
Shaykh al-Islam Ibn Taymiyah (may Allah have mercy on him) was asked about the words of the Prophet (peace and blessings of Allah be upon him): “When a person thinks of doing a good deed but does not do it, one good deed is recorded for him …” If his thinking about it is something hidden and is between him and his Lord, how can the angels see it?
He replied:An answer to this question was narrated from Sufyan ibn ‘Uyaynah, who said: If he thinks of doing a good deed, the angel smells a good fragrance, and if he thinks of doing a bad deed, the angel smells a foul odour.
In fact, Allah is able to tell the angels what is in a person’s heart in whatever manner He wishes. End quote.
And he (may Allah have mercy on him) also said:
Even if they smell the good scent and foul odour, their knowledge is not dependent on what they smell; rather they know what is in the heart of the human being, they can hear it and see the whispers of his nafs (soul). Even the shaytan gets hold of his heart, and when he remembers Allah he retreats, but if his heart neglects to remember Allah he starts to whisper. He knows whether he is remembering Allah or neglecting to remember Him, and he knows what his nafs desires or is inclined towards, and he makes that attractive to him.
It is proven in al-Saheeh from the Prophet (peace and blessings of Allah be upon him) in a hadeeth (report) narrated by Safiyyah (may Allah be pleased with her) that: “The shaytan flows through the son of Adam like blood.”
The fact that the angels and the shaytan are close to a person’s heart is something that is mentioned in numerous reports which reach the level of tawatur (transmitting a narration or religious text by a group of narrators from a group of narrators, generation after generation and so forth, and they are all trustworthy people and it is absolutely impossible for them to agree on a lie), whether the person is a believer or a disbeliever. End quote from Majmoo’ al-Fatawa.
As for what a person thinks in his heart without moving his tongue and uttering it, he will be rewarded for that, but it is not the particular reward that is bestowed by the Lawgiver to the one who mentions that, rather that reward comes for speaking, and speaking is only achieved by uttering the words. But there are some scholars who say that moving the tongue is sufficient even if there is no sound that can be heard. This is the view of the Malikis and is the view favoured by Shaykh al-Islam Ibn Taymiyah, that it is sufficient to move the lips even if the words cannot be heard. End quote.
The majority of scholars think that it is essential to speak the words loud enough to be heard by oneself. Al-Nawawi (may Allah have mercy on him) said in Sharh al-Muhadhdhab: If he cannot hear himself then it is not an announcement or speech. End quote.
He also said: It should be noted that the adhkar (remembrance of Allah) that are prescribed in prayer and elsewhere, whether they are obligatory or mustahabb (preferred), do not count for anything unless they are uttered so that he can hear himself if his hearing is sound. Al-Adhkar.
With regard to a man being brought to account for what he thinks about to himself, this has been answered in question no. 99324.
And Allah knows best.