Subject: Thank you: [Job title] (to fill in) role
Dear [Recruiter / interviewer's name] (to fill in),
Thank you for letting me know about your decision on the [Job title] (to fill in) role at [Company] (to fill in). Although I am disappointed, I appreciate the time you and the team spent interviewing me.
If you have a moment, I would be grateful for any feedback on my interview. Knowing what I could do better would really help me.
I remain very interested in [Company] (to fill in) and would welcome being considered for future openings. I hope we can stay in touch.
Thank you again, and I wish you and the team every success.
Kind regards,
[Your name] (to fill in)
Reply within a day or two, keep it short, and don't argue with the decision. Many recruiters can't share detailed feedback, so don't push if they say no.