Setting a hard "width" it very compatible, but won't squeeze on narrow screens. Setting max-width works well, except in Outlook and Hotmail. We resort to old skool table tricks: a table with width=100%, with 3 columns, only oneof which, the middle one, had content, and a fixed with. This works.
<body style="padding: 0; margin: 0; font-size: 14px; font-family: 'Helvetica Neue', Arial, sans-serif; color: #222">
<table style="background-color: #eee; width: 100%">
<tr>
- <td style="text-align: center; padding: 0px 7px">
- <table style="max-width: 600px; color: #222; margin-left: auto; margin-right: auto">
+ <%# having width=100% on the table and then only a fixed width on the middle cell gives us a max-width that works in Outlook %>
+ <td rowspan="2"></td>
+ <td width="600" style="text-align: center; padding: 0px 7px">
+ <table style="width: 100%; color: #222; margin-left: auto; margin-right: auto">
<tr>
<td style="width: 30px; padding: 10px 10px 10px 0px">
<a href="<%= @root_url %>" target="_blank">
</tr>
</table>
</td>
+ <td rowspan="2"></td>
</tr>
<tr>
<td style="text-align: center; font-size: 11px; font-family: 'Helvetica Neue', Arial, sans-serif">
-<table style="font-size: 15px; margin: 15px 0px; background-color: #eee; max-width: 565px">
+<table style="font-size: 15px; margin: 15px 0px; background-color: #eee; width: 100%">
<tr>
- <td style="width: 50px; vertical-align: top; padding: 15px">
+ <td style="width: 50px; min-width: 50px; vertical-align: top; padding: 15px">
<%= link_to(
image_tag(
attachments["avatar.png"].url,
:target => "_blank"
) %>
</td>
- <td style="text-align: left; vertical-align: top; padding-right: 10px; max-width: 550px">
+ <td style="text-align: left; vertical-align: top; padding-right: 10px; width: 100%">
<%= body %>
</td>
</tr>