Dear {Recipient},
I apologize for calling you names during {event/activity} {last night/yesterday/etc.}. That was very rude and immature of me. Please know that I didn't mean a word I said. You may find this hard to believe, but I actually think highly of you as a {friend/colleague/person}. Unfortunately, it seems I have a tendency for putting my foot in my mouth.
I hope you can forgive me. I promise to be more tactful from now on.
Sincerely,
{Your Name}