tags:

views:

985

answers:

3

Hi there , 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 works fine for displaying other attachments and pictures but i guess it blocks html images ( even if they r background images)

A: 

You haven't included any code or even an example of what your emails look like, so all I can do is give you a general suggestion:

Try sending an email from Gmail manually with an image back to your Gmail account. Confirm that the image displays. Now go to "Show original" and copy-and-paste that into a text file.

Now do the same with email sent from your program: send it to Gmail, "show original" and copy-and-pate into another file.

Now compare these two files. How are they different?

Laurence Gonsalves
My gmail works fine with HTML emails that are sent from OS X mail app for example. when i use the app stationary , the images show up fine.my trouble i guess is in sending an html email using php ....perhaps i should attach the pic and reference the attachement instead. ..I am not sure what's the best approach but surely there has to be one cause i do get html emails with images which work just fine.
salmane
@salmane: So compare what you see in "Show original" of a working email sent from mail.app with what you see in "Show original" of a non-working email sent from your PHP code. "Show original" is in the drop-down menu at the top-right corner of the email (right next to th word "Reply").
Laurence Gonsalves
A: 

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 :)

salmane
A: 

As you've found out, Gmail doesn't support CSS background images.

http://www.email-standards.org/ is a good resource for figuring out email rendering problems in different clients.

jasonbar