unable to send images using html email in script task in ssis

1.6k views Asked by At

I have a package where I send out email with a picture inline. I am using html formatting for that inside the script task in the package.

The problem is, when I put my alias as the recipient, I am getting the expected email. With image and font. But when I put my colleague's alias as the recipient, he is getting only the html page without pictures in it.

Provided that the images are on my local machine, shouldn't he be getting the images also as I am running the package from my end and images are available on my machine?

1

There are 1 answers

0
Rahul Sharma On
****it is not a good approach its better you put image on  some server and upload it and from there via  <img src""> embed into you email body.
This way it will resolve the issue and a standardized way .****

Other wise call the image through config file  and pass that value as a [parameter :

<Configuration ConfiguredType="Property" Path="\Package.Variables     [User::EmbedImagePath].Properties[Value]" ValueType="String">
    <ConfiguredValue>**Path of the file** </ConfiguredValue>
  </Configuration>

than in the script call this :
lnkRes = New LinkedResource(Dts.Variables("EmbedImagePath").Value.ToString, System.Net.Mime.MediaTypeNames.Image.Jpeg)
            lnkRes.ContentId = "**Imagename**"

            altView = AlternateView.CreateAlternateViewFromString(varMailBody, Nothing, System.Net.Mime.MediaTypeNames.Text.Html)
            altView.LinkedResources.Add(lnkRes)