jmail 发送html,JMail的发送HTML格式的电子邮件,图像变量未提交

这篇博客探讨了如何使用JMail组件发送包含内联图像的HTML电子邮件。作者分享了一个VBScript示例,该示例首先将图像文件附加到邮件,然后在HTML正文中引用该图像。然而,作者希望在不实际保存文件的情况下直接发送生成的图像。讨论中提到了使用流来处理内存中的图像,并建议转向.NET System.Drawing.Image和System.IO来处理这种情况。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

Set jmail = Server.CreateObject("JMail.Message")

jmail.AddRecipient "[email protected]", "Mr.Example"

jmail.From = "[email protected]"

jmail.Subject = "Here's some graphics!"

jmail.Body = "A nice picture if you can read HTML-mail."

' The return value of AddAttachment is used as a

' reference to the image in the HTMLBody.

contentId = jmail.AddAttachment("c:\myCoolPicture.gif")

' As only HTML formatted emails can contain inline images

' we use HTMLBody and appendHTML

jmail.HTMLBody = "

Hi, here is a nice picture:
"

jmail.appendHTML ""

jmail.appendHTML "
good one huh?"

' But as not all mailreaders are capable of showing HTML emails

' we will also add a standard text body

jmail.Body = "Too bad you can't read HTML-mail."

jmail.appendText " There would have been a nice picture for you"

jmail.Send("mailserver.mydomain.com")

这是我能找到通过JMAIL发送HTML电子邮件的唯一例子。

但是,正如你在这里看到的,这是一个图像文件。

我的情况是我将生成一个图像,并直接发送它而不保存为一个文件。

那么为此我可以做些什么吗? 我真的不想保存它,然后把它然后将其删除.....

非常感谢

2012-09-26

Franva

+0

也许使用流,如下所示:[System.Drawing.Image流C#](http://stackoverflow.com/questions/1668469/system-drawing-image-to-stream-c-sharp)? –

+0

@Tim使用.NET System.NET.Mail namespce,但正如我明确指出的那样,我正在使用jmail。 –

+0

实际上答案是使用System.Drawing.Image和System.IO - 它与电子邮件无关,只是一种获取图像而不在文件中的方式,除非我错过了某些东西? –

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值