Hi {{first_name}},
Thank you for interviewing for the [[job title]] position. [[Referring employee name]] spoke highly of you, and I can see why. Your experience with [[specific area]] came through clearly in the conversation.
We've decided to go with another candidate whose background was a closer fit for [[specific requirement]]. I wanted to let you know directly before you heard through other channels.
I'd welcome the chance to stay connected. If a role closer to your strengths opens up, I'll reach out.
[[Your name]], [[your role]]