HTML Email not displaying correctly in Outlook 2007

前端 未结 2 1153
梦如初夏
梦如初夏 2021-02-14 00:08

After a lot of time I put into researching. I still can\'t find an answer.

I have a HTML that is showing the wrong width in my tables. Here is a link to the html email:

2条回答
  •  无人及你
    2021-02-14 00:57

    oh the joy of html emails

    There are many rules you have to obey when dealing with HTML-based email, especially when you have exacting clients and pixel-perfect designs, and I am quite glad that I haven't had to work on such a project for at least two years now... The main reason for my utter dislike of the practice is primarily down to two email-clients. The first and all time worst being Lotus Notes 6.5.4 (to be fair it's over 10 years old now.. but still!), and the all time second worst(s), they're not even the best at being bad, Outlook 2007 and 2010!

    Whoever thought it would be a good idea to use the Microsoft Word WYSIWYG HTML Engine to render HTML Emails in Outlook 2007 and 2010, must have been mad, lazy, lost or ever-so-slightly confused (delete as appropriate). It causes no end of rendering problems for developers, usually with random and inexplicable sizing calculations or padding problems.

    Taken from my blog http://blog.pebbl.co.uk/2011/06/collapsible-html-email-and-outlook.html

    Simply put, I do not envy you :)

    I found the best way to help me out with my email troubles was to follow the following rules:

    1. Never use colspans or rowspans.
    2. Always set correct dimensions for your tables and cells.
    3. Use spacer gifs rather than &nbps;.
    4. Always specify correct image sizes and never scale images up or down.
    5. Always add style="display:block;" to images.
    6. Avoid using divs.
    7. If you wish to colour links, put the styling on a span as a child inside the a tag.
    8. Don't use italics.
    9. Don't use BRs for layout, always use tables.
    10. Use BRs in Text, not Ps (to avoid stange margin problems and paragraphing being completely ignored).

    Because the sheer number of emails I used to get through ended up being ridiculous, I developed a script to help me with the work of checking dimensions and other possible pitfalls. If you're interested in using it you can find it here:

    http://pastie.org/6250834

    The script can be added as a usual script tag or enabled using GreaseMonkey or something similar (it was designed to work with Firefox but I see no reason why it shouldn't work elsewhere). Due to the way I used to build my emails, it will only enable itself if either the following conditions are met:

    1. There is an outer wrapping table that has width="100%" set, used to centre the actual email content.
    2. or... there is an outer element (a table or div) that has the id="base".

    I've passed your HTML through it and the image below is the resulting output, it makes more sense when you have the actual page because you can hover over each bordered item and it will give you a rough idea of what the problem is (either that or you can just inspect the element directly with Firebug or similar).

    ss of my email checker script explanation of my email checker

    So from inspecting the above it seems you have a few problems that need to be fixed, I'd say the most important ones are to get rid of rowspans and colspans (these always cause problems in Outlook) and to make sure all your dimensions tally correctly. Once you've fixed these issues you might see a considerable improvement, but then again you might not, there are no certainties in the hazardous life of HTML email building...

    Hope it helps.

提交回复
热议问题