无法在ssis中的脚本任务中使用html电子邮件发送图像

时间:2014-11-28 10:33:32

标签: html ssis script-task

我有一个包裹,我发送带有内嵌图片的电子邮件。我在包中的脚本任务中使用html格式。

问题是,当我将别名作为收件人时,我收到了预期的电子邮件。随着图像和字体。但是当我把同事的别名作为收件人时,他只得到没有图片的html页面。

如果图像在我的本地机器上,那么他也不应该得到图像,因为我从我的终端运行包装并且我的机器上有图像可用吗?

1 个答案:

答案 0 :(得分:0)

****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)