DB Mail and File Attachments

  • I hope this is the correct forum to post this in.  But I want to share with people something we worked through last week.

     

    We are migrating databases from 2000 to 2005.  In the process of doing this, we have some emailing processes that we needed to convert to DB Mail.  In some of these processes, emails are sent and they have file attachments.  When we first began making the transition to DB Mail, we attempted to put a UNC (\\server\directory\myfile.txt) of the file to be attached into the @file_attachments parameter.  The path was to the same server that is running SQL server.  When the sp_send_dbmail was executed, we were getting an error that the file attachment was invalid.  So, we figured DB Mail did not support UNC paths, so we changed it to be the physical drive letter (D on the server were the file resided.  When running the sp_send_dbmail again, we received the same error.  At this point, we figured it had to be some type of permission problem.  So, we copied the file we were trying to attach to the C: drive of the server and change the @file_attachments parameter to the new location.  This time when sp_send_dbmail was executed, it was successful.  This proved there was some type of permission problem and it was our guess that the service account running the DB Engine was the culprit.  So, we give Read permission to the service account on the directory where the file resided on the D: drive.  We changed the @file_attachments parameter back to D: and it worked.

     

    Hope this will save you some time when you run into this kind of problem.  By the way, even after having figured out the permission problem, UNC still did not work.

  • thanks for the pointer.

    Files in the list must be specified as absolute paths, {BOL}


    Everything you can imagine is real.

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

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