Spitefulness is what remains of the traces of others unpleasant words and actions, in the inner self of the one who was spited. Indeed, the mind decides the traces of other unpleasant deeds to remain as it decides for the traces of others pleasant deeds to remain.
‘Abdullah ibn Ka’b ibn Malik narrated that he heard ibn Malik’s story when he did not join the Messenger of Allah, peace and blessings of Allah be upon him, in Tabuk and the story of the revelation and the acceptance of his revelation. He said, “I entered the masjid, while the people were gathered around the Messenger of Allah, peace be upon him, so Talhah ibn Ubaydillah ran to me, shook my hand and congratulated me. By Allah! He was the only man of the immigrants who did that.” He said, “So Ka’b never forgot Talhah for this.” (Recorded in al-Bukhari)
Just as this proves that a good deed is not forgotten, neither is a bad deed. Nevertheless it is preferable to try to remove traces of an ugly deed from the heart.The cure of spitefulness is therefore forgiveness and remission.
There are two stages of forgiveness: First is to know the reward of someone who forgives, and second is to thank the One Who made you be in the position of the forgiver and the other person in the position of the one who errs. The perfection of forgiveness can be reached through being content and this happens by removing all that is in the heart against the other person.
An even more precise cure is to know that you were harmed because of a sin you have committed, or to wipe away a sin, or to raise your rank or to test your patience, and Allah tests those He loves most. You should remind yourself that everything that happens to you is from Allah alone, the One who predestines everything.