embed google qrcode in email

久未见 提交于 2019-12-11 20:40:45

问题


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


回答1:


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


来源:https://stackoverflow.com/questions/7280817/embed-google-qrcode-in-email

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!