I have a scalar function in sql server which is using a clr for attaching file while sending mail using the sql procedure "MSDB.DBO.SP_SEND_DBMAIL ".
I am getting the below error whenever I am trying to send mail.
"The client connection security context could not be impersonated. Attaching files require an integrated client login".
Please help to resolve the issue.
Error when attaching file using clr in sqlserver
1 Answer
Know the answer? Post it. Somebody with the same question will find it here.

Jignesh TrivediRank #16 · 50.3K reputationPosted May 8, 2013, 8:10 PM EDT
hi,
I think, Database mail use microsoft windows security of the current user to control access to the file, so that users who are authenticated with SQL Server Authentication cannot attach files using @file_attachments.
window does not allow SQL server to provide credentials from remote server to other computer. so data server not able to attach the file(s).
Please refer http://msdn.microsoft.com/en-us/library/ms190307.aspx for more deails.
hope this will help you.