Search code examples
c#androidemailgmailgif

Android gmail gif flickering


I'm creating a gif file using a camera in c#, then sending that gif to the persons email. I've attached the gif and created an html email, then display the gif inline using an img tag with the src being the cid of the attached gif file.

Its working perfectly except for androids gmail client. When you view the email in the android gmail client, the gif flashes, showing the background either between frames, at the end of the gif sequence, or sometimes showing the gif once then the gif just disappears.

I am using a table (it seems divs made it worse), and no background images or colors. Sometimes it seemed like certain things i did fixed the problem because it was playing just fine, but after opening the email a couple times or sending a couple more, the gif would do it again (start flashing).

is this a bug in the gmail client or something? nothing i've done seems to help. The gif plays perfectly in every other client i've tried and in the browser works just fine.

Is there something i could try that might fix this problem?

i'm sure people will want to see some code, so here it is, super simple

<table width="100%" border="0" cellspacing="0" cellpadding="0" align="center" style="min-width:638px;">
    <tr>
        <td align="center" valign="top">
            <table width="640px" border="0" cellspacing="0" cellpadding="0" align="center">
                <tr>
                    <td width="78px" height="482px" align="center">
                        <img alt="xxxxxxx" src="cid:B01_frameLeft" border="0" style="display:block;"></a>
                    </td>
                    <td width="484px" height="484px" align="center">
                        <img alt="xxxxxxx" src="cid:B02_gif" border="0" width="484" height="484" style="display:block;"></a>
                    </td>
                    <td width="78px" height="482px" align="center">
                        <img alt="xxxxxxx" src="cid:B03_frameRight" border="0" style="display:block;"></a>
                    </td>
                </tr>
            </table>
        </td>
    </tr>
</table>

Solution

  • So it seems that if there are possibly more than one "layer", the gif "may" flash. I had multiple tables wrapped up in a single table. after removing the container table, the gif stopped flashing. I wonder if android gmail was having a problem because it maybe didn't know if it should display the next frame of the gif or the containing table? I still don't know for sure, but i'm certain that this can be considered a bug, i'm really surprised there is very little on the internet about this.

    anyway, to fix my problem this is what i did.

    • removed all bgcolors and backgrounds from all html in the email
    • removed container table which contained tables for the layout, where one of them contained the gif
    • changed from using divs to using tables

    not sure if all that was needed or not, but after doing those things i don't have a problem with the gif flashing anymore