How to send a log file through Send Mail Task?

  • Hello everyone

    I am trying to attach a log file or insert into email body a text from the same log file.

    My Send Mail task keeps failing.

    Scenario 1

    I am trying to attach a log file to my email:

    Send Mail properties:

    MessageSourceType = Variable

    MessageSource = User::MyVar (MyVar is set as expression to a fully qualified path D:\log\MyLogFile.log)

    FileAttachment is set as expression @User::MyVar resolving to the above file with path.

    Logging is enabled and works fine - I see file D:\log\MyLogFile.log being generated and I can open it etc...

    I am getting the following error:

    [Send Mail Task] Error: Either the file "D:\SSIntegrationServices\log\Person_DataLoad_2009-02-27.log" does not exist or you do not have permissions to access the file.

    Scenario 2

    I am trying to insert text from the log file into email body

    Send Mail properties:

    MessageSourceType = File Connection

    MessageSource = Log ConnectionManager Name

    I am getting the follwoing error:

    [Send Mail Task] Error: An error occurred with the following error message: "Object reference not set to an instance of an object.".

    Please help!

    Pit

  • Is D a local or mapped drive?

    Are you attempting this via BIDS, a scheduled job, dtsexec?

  • Jack Corbett (3/2/2009)


    Is D a local or mapped drive?

    Are you attempting this via BIDS, a scheduled job, dtsexec?

    D drive is local.

    I tried three ways:

    From BIDS - 1. execute standalone task - it actually works.

    2. execute the entire package - fails

    From SQL Agent - schedule and run the entire package - fails

    It seems to me that somehow the log file is used by another process and not released on time for consumption by Send Mail Task...

    Thanks,

    Pit.

  • I am trying to attach a log file or insert into email body a text from the same log file.

    My Send Mail task keeps failing.

    Scenario 1

    I am trying to attach a log file to my email:

    Send Mail properties:

    MessageSourceType = Variable

    MessageSource = User::MyVar (MyVar is set as expression to a fully qualified path D:\log\MyLogFile.log)

    FileAttachment is set as expression @User::MyVar resolving to the above file with path.

    Logging is enabled and works fine - I see file D:\log\MyLogFile.log being generated and I can open it etc...

    I am getting the following error:

    [Send Mail Task] Error: Either the file "D:\SSIntegrationServices\log\Person_DataLoad_2009-02-27.log" does not exist or you do not have permissions to access the file.

    ------------------------

    hey,

    this worked perfectly for me

    Hello everyone

    please make sure that in expression choose property as "File attachments" and in expression choose User::MyVar

  • I had the same problem - I solved it with a little workaround: just create a copy of the locked file and attach it to the mail. worked fine in my case

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

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