No image when stationery applied via code

J

John

Hi

I am applying stationary to my outgoing email message when sending mail via
code. The exact code is given at the end. The problem is that the image doe
snot appear in the stationery at the other end. What is the problem and how
can I get the image to accompany the mail as part of the stationary?

I am running the code from within MS Access.

Many Thanks

Regards


Code
====

Set OutlookApp = New Outlook.Application
Set EM = OutlookApp.CreateItem(olMailItem)

With EM
.To = "(e-mail address removed)"
.Subject = "Any Subject"
.HTMLBody = HTMLTextAndSignature("This is body text")
.Display (False)
End With


Function HTMLTextAndSignature(EmailBody) As String
Dim fso
Dim Ts
Dim Signature As String

Set fso = CreateObject("Scripting.FileSystemObject")
Set Ts = fso_OpenTextFile("F:\Email Stationery\Email_Template.htm", 1)
Signature = Ts.ReadAll

' [Body] is a tag in html file as a placeholder to actual body text ,
[Body] is replaced with actual body text here
If IsNull(EmailBody) Then
Signature = Replace(Signature, "[Body]", " ")
Else
Signature = Replace(Signature, "[Body]", EmailBody)
End If

HTMLTextAndSignature = Signature
End Function


Content of Email_Template.htm, the image that does not display is F:/Email
Stationery/investor+small.jpg
======================================================================

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML>
<HEAD>
<META http-equiv=Content-Type content="text/html; charset=windows-1252">
<style type="text/css">
<!--
body {
background-attachment: fixed;
background-color: "#FFFFFF";
background-repeat: no-repeat;
font-family: "Century Gothic";
font-size: 10pt;
font-weight: normal;
}
-->
</style>
</HEAD>
<BODY BACKGROUND="file:///F|/Email Stationery/E.jpg" bgcolor="#FFFFFF">
<table border=0 summary="">
<tr>
<td width="464">
<DIV align=left>
My Name<BR>
</DIV>
</td>
<td width="70" valign="bottom"><br>
<img src="file:///F|/Email Stationery/investor+small.jpg" width="89"
height="59">
</td>
</tr>
</table>
</body>
</HTML>
 
B

B Clumpner

John,

Your html code is linking to the graphic on your system. Since outside folks
don't have access to your system, it comes up blank. If you can park the
graphic on a web-site somewhere and reference that URL in your code, your
image will link from every message that's sent out.

Bruce
 
S

Sue Mosher [MVP-Outlook]

Except that current versions of Outlook and many other mail programs don't display externally linked images. See http://www.outlookcode.com/d/code/htmlimg.htm for a code technique for inserting embedded images in HTML.

--
Sue Mosher, Outlook MVP
Author of Microsoft Outlook 2007 Programming:
Jumpstart for Power Users and Administrators
http://www.outlookcode.com/article.aspx?id=54


B Clumpner said:
John,

Your html code is linking to the graphic on your system. Since outside folks
don't have access to your system, it comes up blank. If you can park the
graphic on a web-site somewhere and reference that URL in your code, your
image will link from every message that's sent out.

Bruce

John said:
Hi

I am applying stationary to my outgoing email message when sending mail via
code. The exact code is given at the end. The problem is that the image doe
snot appear in the stationery at the other end. What is the problem and how
can I get the image to accompany the mail as part of the stationary?

I am running the code from within MS Access.

Many Thanks

Regards


Code
====

Set OutlookApp = New Outlook.Application
Set EM = OutlookApp.CreateItem(olMailItem)

With EM
.To = "(e-mail address removed)"
.Subject = "Any Subject"
.HTMLBody = HTMLTextAndSignature("This is body text")
.Display (False)
End With


Function HTMLTextAndSignature(EmailBody) As String
Dim fso
Dim Ts
Dim Signature As String

Set fso = CreateObject("Scripting.FileSystemObject")
Set Ts = fso_OpenTextFile("F:\Email Stationery\Email_Template.htm", 1)
Signature = Ts.ReadAll

' [Body] is a tag in html file as a placeholder to actual body text ,
[Body] is replaced with actual body text here
If IsNull(EmailBody) Then
Signature = Replace(Signature, "[Body]", " ")
Else
Signature = Replace(Signature, "[Body]", EmailBody)
End If

HTMLTextAndSignature = Signature
End Function


Content of Email_Template.htm, the image that does not display is F:/Email
Stationery/investor+small.jpg
======================================================================

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML>
<HEAD>
<META http-equiv=Content-Type content="text/html; charset=windows-1252">
<style type="text/css">
<!--
body {
background-attachment: fixed;
background-color: "#FFFFFF";
background-repeat: no-repeat;
font-family: "Century Gothic";
font-size: 10pt;
font-weight: normal;
}
-->
</style>
</HEAD>
<BODY BACKGROUND="file:///F|/Email Stationery/E.jpg" bgcolor="#FFFFFF">
<table border=0 summary="">
<tr>
<td width="464">
<DIV align=left>
My Name<BR>
</DIV>
</td>
<td width="70" valign="bottom"><br>
<img src="file:///F|/Email Stationery/investor+small.jpg" width="89"
height="59">
</td>
</tr>
</table>
</body>
</HTML>
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top