这里想要发送具有相同背景的多个动态图像..无法在gmail..pls帮助中将base64string显示到图像中 [英] Here want to send multiple dynamic image with same background ..not able to display base64string into image in gmail..pls help

查看:66
本文介绍了这里想要发送具有相同背景的多个动态图像..无法在gmail..pls帮助中将base64string显示到图像中的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

从数据库读取后的动态图像我发送到gmail它无法在gmail中显示。



Html部分:

dynamic image after reading from database i am sending into gmail it's unable to display in gmail.

Html Part:

<tr style="removed: relative; removed 2; removed 0;">
                    <td style="" font-weight:bold="" xmlns:font-weight="#unknown">
                        <img src=cid:myImageID>
			<img src="data:image/jpg;base64,/pic" width="23%" height="40%" style="position: absolute; top: 210px; left: 4px;"/>





代码将< img src =data:image / jpg; base64,/ pic转换为base64String :





code behind for converting <img src="data:image/jpg;base64,/pic" to base64String :

foreach (DataRow row in rows)
                 {
                     ImgUrl = row["ImageName"].ToString();
                     using (Image image = Image.FromFile(ImgUrl))
                     {
                         using (MemoryStream m = new MemoryStream())
                         {
                             image.Save(m, image.RawFormat);
                             imageBytes = m.ToArray();
                             ContentType c = new ContentType("image/jpeg");
                             // Convert byte[] to Base64 String
                             base64String = Convert.ToBase64String(imageBytes);
                             body = body.Replace("/pic", base64String);
                         }
                     }
                     ImgList.Add(ImgUrl);
              }





我尝试过:





What I have tried:

?

推荐答案

我很确定这不是处理图像的方法 - 所有人都应该使用一个LinkedResource来添加你的形象 - 谷歌上有很多点击量,这里有两个点击,一个甚至在CP上可能会让你开始/处于更好的位置



使用LinkedResource发送电子邮件 [ ^ ]



c# - 在电子邮件中发送内联图片 - Stack Overflow [ ^ ]



看起来像LinkedResource一样有各种构造函数,一个流是一个,所以你可以传入你的内存流'm'
I'm pretty sure that's not the way to handle images - you should, by all accounts, be using a LinkedResource to add your image - plenty of hits on google for it, here's two hits, one even here on CP that might get you started/in a better position

Sending Email with LinkedResource[^]

c# - Send inline image in email - Stack Overflow[^]

It looks like LinkedResource has various constructors, a stream being one, so you may be able to pass in your memorystream 'm'


这篇关于这里想要发送具有相同背景的多个动态图像..无法在gmail..pls帮助中将base64string显示到图像中的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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