在电子邮件中嵌入谷歌QR code [英] embed google qrcode in email

查看:456
本文介绍了在电子邮件中嵌入谷歌QR code的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个code发送一封电子邮件,使用aspemail嵌入式图像。

在code中,我得到了℃的常规图像; IMG>标签从谷歌 - 所以我得到的QR code

在电子邮件中,如果客户端不下载图像automaticaly,他将看不到图片

aspemail的嵌入不能嵌入图像/文件,是不是本地的。

有没有办法从给URL本地保存的图像?

如果我得到的图像从谷歌: <$c$c>https://chart.googleapis.com/chart?chs=150x150&cht=qr&chl=http://www.sitedomain.com&choe=UTF-8

和有它特定的文件夹下保存为一个唯一的名称


解决方案

 功能SaveBinaryData(文件名,字节)
  常量adTypeBinary = 1
  常量adSaveCreateOverWrite = 2  昏暗的BinaryStream
  设置BinaryStream =的CreateObject(的ADODB.Stream)  BinaryStream.Type = adTypeBinary  BinaryStream.Open
  BinaryStream.Write的ByteArray  BinaryStream.SaveToFile文件名,adSaveCreateOverWrite
结束功能设置objHTTP =的Server.CreateObject(Msxml2.ServerXMLHTTP)
指向有足够的访问权限授予一个图像文件
objHTTP.openGET, \"https://chart.googleapis.com/chart?chs=150x150&cht=qr&chl=http://www.domian.com&choe=UTF-8\",false
objHTTP.send
Response.BinaryWrite objHTTP.ResponseBody
调用SaveBinaryData(使用Server.Mappath()及。;\\ test.png,objHTTP.ResponseBody)
设置objHTTP =什么

I have a code that sends an email with embeded images using aspemail.

within the code i get a regular image by the <img> tag from google - so i get the qrcode

in the email, if the client does not download images automaticaly, he won't see the image

the embed of aspemail can't embed image/file that is not local

is there a way to save locally an image from a giving url?

if i get image from google: https://chart.googleapis.com/chart?chs=150x150&cht=qr&chl=http://www.sitedomain.com&choe=UTF-8

and have it saved as a unique name under specific folder

解决方案

Function SaveBinaryData(FileName, ByteArray)
  Const adTypeBinary = 1
  Const adSaveCreateOverWrite = 2

  Dim BinaryStream
  Set BinaryStream = CreateObject("ADODB.Stream")

  BinaryStream.Type = adTypeBinary

  BinaryStream.Open
  BinaryStream.Write ByteArray

  BinaryStream.SaveToFile FileName, adSaveCreateOverWrite
End Function

Set objHTTP = Server.CreateObject("Msxml2.ServerXMLHTTP")
' Point to an image file with adequate access permissions granted
objHTTP.open "GET", "https://chart.googleapis.com/chart?chs=150x150&cht=qr&chl=http://www.domian.com&choe=UTF-8",false
objHTTP.send
'Response.BinaryWrite objHTTP.ResponseBody
call SaveBinaryData(Server.MapPath(".") & "\test.png", objHTTP.ResponseBody)
Set objHTTP = Nothing

这篇关于在电子邮件中嵌入谷歌QR code的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆