I am sending an HTML email that contains an image with cfmail. In summary the code looks like this:
<cfmail from="[email protected]" to="[email protected]" subject="My Subject" type="html">
<img src="http://www.mywebsite.com/images/my_image.jpg" style="height:120px;" alt="My Image" />
</cfmail>
As you can see, I set the CSS height attribute to 120px. In the browser, this scales the image to 120px high and automatically determines the proportionate width. In email, at least in Outlook 2007, it does nothing. The image appears with its original height and width.
I'm sending from a ColdFusion9 box, so I've tried using cfimage without any luck, but it's likely I'm just doing something wrong. Any way to resize this image in the email on the fly? Thanks!
Outlook 2007/2010 doesn't like css style="height:150px" however the following will function
<img src="...." height="150">
Outlook doesn't play nicely with CSS, and in general you need to fall back to ugly inline styles such as <img height="120">
. Here's a nice reference table showing what each email client does and doesn't support.
In there you can see height is not supported in CSS in Outlook 2007/2010 despite it being supported in 2003. That's progress for you! The TLDR version is simply that so much css breaks in Outlook that it's rather depressing!