发送HTML邮件,但图片未显示在gmail中 [英] sending html mail with images not displaying in gmail

查看:361
本文介绍了发送HTML邮件,但图片未显示在gmail中的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在通过php发送html电子邮件.电子邮件具有背景图片,当我使用gmail,hotmail或yahoo邮件对其进行测试时,该图片未显示.我尝试使用图片标签,但也不起作用. 如果使用OSX Mail或Mozilla或Outlook之类的电子邮件客户端,则图像效果很好. 有什么想法吗?

I am sending html emails through php . the email has a background image that is not showing when i test it with gmail, hotmail or yahoo mail. I have tried to use an image tag but that doesnt work either. the image works perfectly fine if using an email client like OSX Mail or Mozilla or outlook. Any ideas?

很抱歉没有添加任何代码.这是我尝试实现的方法:

sorry about not adding any code. here is how i tried to implement it :

    <div style="border-bottom:1px solid #CCCCCC; padding:0 20px; background-color:#EDEDED; background-image:url(http://www.mysitename.com/images/email_header.png); background-repeat: no-repeat; background-position: 520px center; height:120px;"> 
Header 
</div>

gmail可以很好地显示其他附件和图片,但是我猜它会阻止html图像(即使它们是背景图像)

gmail works fine for displaying other attachments and pictures but i guess it blocks html images ( even if they r background images)

推荐答案

事实证明,我正在使用CSS在背景中显示图片. Gmail不喜欢这样.相反,我使用了图像标签. 我不能证实这一点,但是:我以前也做过但没有成功,但是以前所做的是我没有在布局中使用表格. 总结一下... 将表格用于html电子邮件的布局 插入带有width,height,alt标签的图片标签 和gmail,hotmail和yahoo会显示您的图片. 希望这可以为某人节省时间:)

It turns out I was using CSS to have the picture in the background. Gmail didnt like that. instead i used an image tag. I cant substantiate this but : I have done that previously too with no success but what did previously is that i did not use tables for my layout. so to sum up... use tables for the layout of the html email insert image tag with width, height , alt tag and gmail , hotmail and yahoo would display ur image. hope this saves sometime for someone :)

这篇关于发送HTML邮件,但图片未显示在gmail中的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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