Database Mail File attachement Error

  • Hi,

    I have create on User i.e. User1 with db_owner permission

    and gave access to One on User Database DB1 and gave access of DBMailUserRole to msdb database.

    When user fires the script

    Use DB1

    GO

    EXEC msdb.dbo.sp_send_dbmail

    @profile_name='SQLMail',

    @recipients = 'abc@gmail.com',

    @body = 'Test',

    @subject = 'Test' ,

    @file_attachments = 'F:\CRM\TEST.TXT',

    @Body_Format = 'HTML'

    GO

    following error is displayed

    Msg 22051, Level 16, State 1, Line 0

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

    Please give me solution for the same.

    Thanks and Regards,

    Nikhil P Desai

  • nikhil.desai1 (1/16/2012)


    Hi,

    I have create on User i.e. User1 with db_owner permission

    and gave access to One on User Database DB1 and gave access of DBMailUserRole to msdb database.

    When user fires the script

    Use DB1

    GO

    EXEC msdb.dbo.sp_send_dbmail

    @profile_name='SQLMail',

    @recipients = 'abc@gmail.com',

    @body = 'Test',

    @subject = 'Test' ,

    @file_attachments = 'F:\CRM\TEST.TXT',

    @Body_Format = 'HTML'

    GO

    following error is displayed

    Msg 22051, Level 16, State 1, Line 0

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

    Please give me solution for the same.

    Thanks and Regards,

    Nikhil P Desai

    As the error says, you need to use a windows/domain login only in order to send files as attachment using databases mail (SP_Send_DBMail).

    As per Books Online:


    Database Mail uses the Microsoft Windows security context of the current user to control access to files. Therefore, users who are authenticated with SQL Server Authentication cannot attach files using @file_attachments.

    You can read more here.


    Sujeet Singh

Viewing 2 posts - 1 through 2 (of 2 total)

You must be logged in to reply to this topic. Login to reply