Dear {Ex-Boyfriend},
After we broke up, I spent the next {number of} {months/years} being mad at you. You could even say I hated you. But I'm not upset anymore, and I'm actually grateful to you.
Things may not have worked out between us, but in the end it was all for the best. And you're not a bad guy, you just weren't the right guy. We did have a lot of good times together, and I'll always look back on our relationship fondly.
Thank you for everything. For {nice things he did for you}. I wish you nothing but the best, because you really deserve it.
Sincerely,
{Your Name}