首页
学习
活动
专区
圈层
工具
发布
首页
学习
活动
专区
圈层
工具
MCP广场
社区首页 >问答首页 >邮件发送4调用objMail.AddEmbeddedImage时错误“800a0007”

邮件发送4调用objMail.AddEmbeddedImage时错误“800a0007”
EN

Stack Overflow用户
提问于 2011-12-11 07:51:09
回答 2查看 2.2K关注 0票数 1

我使用Persits 在经典ASP应用程序中发送电子邮件。我以前多次使用过它,但我从未遇到过以下问题:

我需要将图像嵌入到电子邮件的正文中,但这个映像实际上是虚拟的(我使用IIS重写来处理所有URL重写,因此当从特定目录请求图像时,IIS重写调用一个使用Persits组件显示映像的.asp页面),但当我尝试这样做时,AspEmail返回这个错误:

代码语言:javascript
运行
复制
Persits.MailSender.4 error '800a0007'
The system cannot find the path specified.

任何其他不是虚拟的映像都会被嵌入。

代码很简单:

代码语言:javascript
运行
复制
Set objMail = Server.CreateObject("Persits.MailSender")
...
objMail.AddEmbeddedImage virtualImageUrl, virtualImageCid
...
objMail.Send

我在这里做错什么了吗?如果AspEmail不能处理虚拟文件,那么有什么办法可以解决这个问题呢?请,除了使用FSO临时复制文件到一个目录,以嵌入它,或留在服务器上的图像-我真的需要它被嵌入。

谢谢(非常感谢!)预先,

干杯,

标记

P.S.:我的服务器正在运行IIS7.5/ IIS重写模块2/ AspEmail v5.1.0.3。

EN

回答 2

Stack Overflow用户

发布于 2011-12-11 15:29:26

AddEmbeddedImage属性需要物理路径。而且它不会发出http请求(以获得动态脚本响应)。

4.2 AddEmbeddedImage方法 (2) the physical path to an image file,通过使用两个参数的方法AddEmbeddedImage提供对嵌入式图像的支持: AspEmail及其内容ID,它只是一个没有空格的任意字符串。 如果您的邮件包含多个嵌入的图像,则必须为每个图像分配一个唯一的内容ID。

但是还有一个比AddEmbeddedImage更适合使用动态图像的属性。您需要发出一个http请求,并使用AspEmail属性将响应传递给您的AddEmbeddedImageMem实例。

类似解决方案:在电子邮件中嵌入google qrcode

票数 2
EN

Stack Overflow用户

发布于 2011-12-12 00:03:28

我所做的是:

由于我还使用Persits 来生成虚拟映像,所以我使用objAspJpeg.Binary属性将映像临时保存到一个变量中,然后将该变量传递给objMail.AddEmbeddedImageMem方法和voilà。

代码语言:javascript
运行
复制
'First: AspJpeg to process and generate the virtual binary image.'

Set objAspJpeg = Server.CreateObject("Persits.Jpeg")
objAspJpeg.Open(Server.MapPath(physicalImgUrl))   'Actual, physical image.'

'...some image processing: resizing, etc...'

processedVirtualImg = objAspJpeg.Binary   'Generated virtual image.'
Set objAspJpeg      = Nothing

'Second: AspEmail to embed the virtual image and send the email.'

Set objMail    = Server.CreateObject("Persits.MailSender")
objMail.Host   = "www.example.com"
'< the rest of the config parameters here >'

objMail.Body   = "<img src=""cid:virtualImgId"" />"
objMail.IsHTML = True

objMail.AddEmbeddedImageMem "image.jpg", "virtualImgId", processedVirtualImg

objMail.Queue  = True
objMail.Send

Set objMail    = Nothing
票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/8462629

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档