Thursday, October 18, 2012

Troubleshooting ‘The client connection security context could not be impersonated. Attaching files require an integrated client login’

I am calling msdb.dbo.sp_send_dbmail from my C# console application and is connecting via a SQL Server Database user. When I call stored proc from C# I get the message below.

The client connection security context could not be impersonated. Attaching files require an integrated client login

there are some things you can try.

  • If you want to use a SQL Server Database user you still can, but you will need to give that user sysadmin rights. You can add those permissions using the following command:
  • sp_addsrvrolemember '<Login>', 'sysadmin' 
  • Try connecting as a Windows users instead of a SQL Server Database user. In other words, try a domain user.
  • Make sure the file is not too large. The default size is 1,000,000 bytes (nearly 1MB). You can change the max attachment size using the following command:

    USE msdb
    EXEC sysmail_configure_sp @parameter_name='MaxFileSize', @parameter_value=N'1572864'
    GO

    In the example above the new max attachment is 1.5MB

No comments: