Skip to Content
avatar image
Former Member

attach file for failed data

Hi,

Scenario....

I have a job with the validation transformation where I have check the validation and send data to pass table if the logic satisfied and send to fail table if the logic fails. Now i have to generate a file for the failed data table and send the file to user using smtp_to. How i can achieve this.

Thanks

Add comment
10|10000 characters needed characters exceeded

  • Get RSS Feed

2 Answers

  • avatar image
    Former Member
    Sep 11, 2017 at 02:38 PM

    Hi Jyoti,

    smtp_to or mail_to functions will not support for sending the file as attachment or not even HTML formatting of message body.

    You may need to write some VB script and then call the same using exe function from scripts.

    Regards

    Chaitanya

    Add comment
    10|10000 characters needed characters exceeded

  • Sep 12, 2017 at 01:01 PM

    Hi Jyoti Deka,

    Please use below VB script and save it with .vbs extension and use this "exec(‘cscript’,'[$G_LOCATION]\email.vbs’, 8); " in BODS script

    strSMTPFrom = "no-reply@yourcompany.com"
    strSMTPTo = "helpdesk@yourcompany.com"
    strSMTPRelay = "smtp relay server name or IP address"
    strTextBody = "Body of your email"
    strSubject = "Subject line"
    strAttachment = "full UNC path of file"


    Set oMessage = CreateObject("CDO.Message")
    oMessage.Configuration.Fields.Item("http://schemas.microsoft.com/cdo/configuration/sendusing") = 2
    oMessage.Configuration.Fields.Item("http://schemas.microsoft.com/cdo/configuration/smtpserver") = strSMTPRelay
    oMessage.Configuration.Fields.Item("http://schemas.microsoft.com/cdo/configuration/smtpserverport") = 25
    oMessage.Configuration.Fields.Update

    oMessage.Subject = strSubject
    oMessage.From = strSMTPFrom
    oMessage.To = strSMTPTo
    oMessage.TextBody = strTextBody
    oMessage.AddAttachment strAttachment

    oMessage.Send

    Add comment
    10|10000 characters needed characters exceeded