A large amount of money came into his account and he spent it all
Question

I found a large amount of money in my account twelve years ago, and I was in need of it, so I spent it. I do not know who deposited it in my account. We checked with the bank and they could not find the name of the person who deposited it. All they were able to find out was the place where the deposit was made. Now I want to discharge my responsibility concerning it. Should I give the money to some charitable cause, with the intention of the reward going to the person who deposited the money in my account?
Praise be to Allah.The depositing of the money in your account may have been a mistake, or it may have been done deliberately. But the idea of it having been done deliberately is very unlikely, because in that case it would be money that the owner did not want, and he gave it to you, so you could keep it. If it was done by mistake – which is what appears to be the case – then it must be returned to its owner. If you are not able to find out who its owner is, then you should give it in charity on his behalf, on the basis that, if one day you find out who its owner was, you will give him the choice between approving of that charity or taking back his money. 
Shaykh al-Islam Ibn Taymiyah (may Allah have mercy on him) said:
If a person has money or property, and does not know who the owner is – as in the case of one who seized it by force and has repented, or one who acquired it by treachery and has repented, and the like, who has property in his possession of which he is not the owner, but he does not know who the owner is – then he should give it to people who are in need or spend it in the interests of the Muslims. 
Al-Fataawa al-Kubra (4/220) 
He (may Allah have mercy on him) was also asked about some pilgrims who encountered some Bedouin bandits who had been raiding travellers and had taken their fabric. They fled, leaving behind their camels and the fabric. Is it permissible to take the camels that belonged to the thieves and the fabric that they stole, or not? 
He replied:
What they took of the pilgrims’ property must be returned to them, if possible. This is like lost property which should be announced for a year. If its owner comes along and claims it, all well and good, otherwise the finder may spend it (or use it) on condition that he assume liability. 
But if the finder despairs of ever finding its owner, then he may give it in charity and spend it in the interests of the Muslims. 
The same applies to any property of which the owner is not known, such as property seized by force, borrowed items, items that were left in trust, and items seized from thieves, which belong to people, or items that have been thrown away. All such property may be given in charity or spent in the interests of the Muslims. 
Majmoo‘ al-Fataawa (30/413) 
And Allah knows best.