I had a requirement to send email with attachment in bods.
I read through some of the article in SCN but none of it provided a detailed way of achieving it.
I found the article (Add an attachment to BODS Job Notification email using VB Script ) somewhat interesting but it was not working for me
So I did a little research and came up with a solution that can be implemented in BODS.
We’ll do it using vb script and then calling that script in our job.
Step 1: Use below code to make a vb script file.
Open a notepad, write below code by making necessary changes to highlighted text and then save it as email.vbs
MyEmail.TextBody = “This is the message body.”
MyEmail.AddAttachment “attachment file path” — NO EQUAL TO SIGN HERE
(Note: Attachment filepath – This has to be a shared directory or location which is accessible by the DS. Common mistake people include “equal to ‘=’ “sign near Add attachment which results in an error)
MyEmail.Configuration.Fields.Item (“http://schemas.microsoft.com/cdo/configuration/sendusing“)= 2
MyEmail.Configuration.Fields.Item (“http://schemas.microsoft.com/cdo/configuration/smtpserver“)= “smtp relay server name”
MyEmail.Configuration.Fields.Item (“http://schemas.microsoft.com/cdo/configuration/smtpserverport“)= 25
Step 2: In Job place the below script:
Script_Email which includes a call to email.vbs script file:
e.g. exec(‘cscript’,’filepath\email1.vbs’, 8);
Filepath where email.vbs is located.