Be clear, brief, and always send this after the interview.
Hi [first name],
We appreciate your interest in [company name] and the time you’ve invested in applying for the [role title] opening.
We moved forward with another candidate, but we enjoyed learning about your skills and accomplishments.
Look out for more positions advertised in the coming months. We hope you’ll keep us in mind and we encourage you to apply again.
We wish you all the best in your future professional endeavors.