MailMessage AlternateView background image

MattP

Well-known member
Joined
Feb 29, 2008
Messages
1,206
Location
WY, USA
Programming Experience
5-10
I have an issue where I'm trying to send out an email with a stretched image for the background and text overlaying the image. The markup I'm using works fine in a browser (IE, Firefox, Opera) but the image shows in-line when I create the view and open it with Outlook 2007.

VB.NET:
		Dim content As String = My.Settings.htmlContent
		Dim view As AlternateView = AlternateView.CreateAlternateViewFromString(content, Nothing, "text/html")

		Dim resource As New LinkedResource("C:\Temp\CustomerMailer\myImage.jpg", "image/jpeg")
		resource.ContentId = "blast"
		resource.TransferEncoding = Mime.TransferEncoding.Base64

		view.LinkedResources.Add(resource)

My.Settings.htmlContent:

<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en">
<head>
<title>Sample HtmlView Email</title>
<style type="text/css">
html, body {margin:0; padding:0; width:100%; height:100%; overflow:hidden;}
body {font-family:verdana, arial, sans-serif; font-size:76%;}
#background{position:absolute; z-index:1; width:100%;}
#scroller {position:absolute; width:100%; height:100%; top:0; left:0; overflow:auto; z-index:2;}
#content {padding:10% 30% 10% 30%;}
p {line-height:1.8em; letter-spacing:0.1em; text-align:justify;}
</style>
</head>
<div>
<img id="background" src="cid:blast" alt="" title="" />
</div>
<div id="scroller">
<div id="content">
<p>Some email text</p>
<p>Some more text that is much longer. Some more text that is much longer. Some more text that is much longer.</p>
</div>
</div>
</body>
</html>

If someone can point me in the right direction to stretch the background image and not inline it in an email it would be much appreciated. Thank you in advance.
 
Back
Top