Over the course of the series, a few letters have been written.
He wrote it after Bonnie magically linked him and Elena so that she could live after Klaus' sacrifice ritual and it gave her a chance to not come back as a vampire. However, for the spell to work and for Elena to live, John had to die. Knowing that he would never talk to Elena again, he wrote the letter and gave it to Jeremy to pass along to Elena, including his ring.
Today I did things I abhor to protect the one thing I value most, my family. If anyone can understand it, it's you. Your compassion is a gift, Elena. Carry it with you, as I will carry my regret. Always and forever.
If anything happens to me, carry on my work. You have the other ring, let the ring make you strong. The council must be cleansed before the work can begin.
I'm sorry for what you're going through. What I did was a necessary sacrifice, and I'm afraid it's only the first of many more sacrifices to come. There's always been an evil that spread through Mystic Falls, but now a greater one is coming. My death is but the first in the war ahead. I will see you again when we all find our salvation.
Until then, I love you.
Dear Car, I miss you more than I can put into words. But I know as long as Klaus is alive, I can't come home. He won't stop trying to kill me. And you won't stop trying to protect me. Which means the only way to make sure you're safe is for me to go and never come back. I left Matt the deed to the house. It will protect you in ways that I can't anymore. I will always love you.
I hear Elijah has refused you the cure, and in return you have refused my freedom. Shame on you both. But while you boys sort our your problems, I have one last thing to offer you. I have caught wind that there is a witch in New Orleans named Jane-Anne Devereux plotting a move against you. Hunt her down. What she has to say will rattle you so deeply to your core that chasing little old me will be the least of your concerns. It's been a fun five centuries Klaus, but I've worn down too many good heels running from you.
Love, and hate.