HTML email image tag missing src attribute

帅比萌擦擦* 提交于 2019-12-11 06:03:47

问题


I have a problem that I cant find the answer by Googling. I hope I can get one here. My problem is: My system can send email to user. On local, an image tag on email is like this:

<img src="http://myimageurl" width="300" style="display:block;margin:auto" alt="">

When working on real server:

<img width="300" style="display:block;margin:auto" alt="">

As you can see, my src attribute is disspeared. I just dont know why!

My email tempalte(Im using cakePhp):

<?php 
echo $this->Html->image(
    Router::url('/', true). 'img/eventflair-logo.png',
        array(
            'width' => '300',
            'style' => 'display:block; margin: auto'
        )); 
?>

Best Regards.


回答1:


Gmail by default doesn't show images in email. To see the original email source select "show original" from email dropdown menu.




回答2:


It seems gmail recently become more strict on urls allowed in emails. I had an img url that was formatted like "//cdn.someurl.com" which would render find on gmail until around a month ago, and is now having problems like you described.

It looks like gmail is auto appending the http:// to the url, so taking out the 2 leading /s worked for me. Maybe taking out the http:// from your url will work.



来源:https://stackoverflow.com/questions/20237632/html-email-image-tag-missing-src-attribute

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