Attachment file is Invalid

  • Hi,

    I am not sure why i am getting the following error.

    Msg 22051, Level 16, State 1, Line 0

    Attachment file \\sasi\Testing.txt is invalid.

    when executing the following one.

    EXEC msdb.dbo.sp_send_dbmail

    @recipients=N'sasipuli@gmail.com',

    @profile_name =N'SQLMail',

    @subject =N'Testing mail ',

    @body=N'Please see attachment for details',

    @file_attachments=N'\\sasi\Testing.txt'

    When executing the same without attachment its sending mail.

    Please give me steps to send the txt file as attachment.

    Thanks,

    Sasidhar P

  • Map \\Sasi as a drive letter and use it as N'f:\Testing.txt', F being the drive letter or whatever you assigned.

    -----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
    This thing is addressing problems that dont exist. Its solution-ism at its worst. We are dumbing down machines that are inherently superior. - Gilfoyle

  • Thanks for info...

    But we know the shared path on the server only...not the drive path exactly...

    I got the info that the problem was with the SQL Service account not having the access to the shared drive.

  • What Henrico suggested is you should map the shared folder to a drive letter.

    right click my computer and click on map network drive. select a drive letter and enter the shared path there.

    use this drive letter for your attachment in the mail and see if that works.



    Pradeep Singh

Viewing 4 posts - 1 through 3 (of 3 total)

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