Connecting Tech Pros Worldwide Forums | Help | Site Map

Insert HTML into Outlook message with Javascript

jeff.boggs@inovex.ca
Guest
 
Posts: n/a
#1: Jun 1 '06
Hello,

I have a problem inserting HTML from a Word document into a new Outlook
mail message. The message ends up losing all of the formatting and the
image that is supposed to appear at the top of the message does not.

Here is the code for inserting the HTML.

var oOutlookApp, oWordApp, oOutlookMsg, iOutlookRunning;
iOutlookRunning = false;
var attach = "c:\\test.txt"
var attach2 = "c:\\test.txt"
var attach3= "c:\\EmailTemplate.htm";

//Create Outlook Object
oOutlookApp = new ActiveXObject("Outlook.Application");
oDoc = new ActiveXObject("Word.Application");
//Create Outlook Message
oOutlookMsg = oOutlookApp.CreateItem(0);
oOutlookMsg.BodyFormat = 2;

oDoc.Visible = false;
oDoc.Documents.Open(attach3);
iOutlookRunning = true;

oOutlookMsg.To = sText + "@inovex.ca";


oOutlookMsg.Subject = "test";
oOutlookMsg.Body = oDoc.ActiveDocument.Content;

oOutlookMsg.Attachments.Add(attach,1);
oOutlookMsg.Attachments.Add(attach2,2);
oOutlookMsg.Attachments.Add(attach3,3);

//Send Email
oOutlookMsg.Send;




RobG
Guest
 
Posts: n/a
#2: Jun 2 '06

re: Insert HTML into Outlook message with Javascript


jeff.boggs@inovex.ca wrote:[color=blue]
> Hello,
>
> I have a problem inserting HTML from a Word document into a new Outlook
> mail message. The message ends up losing all of the formatting and the
> image that is supposed to appear at the top of the message does not.[/color]

I think you're lost. :-)

Try an Outlook or JScript news group or support forum:

MSDN forums:
<URL:http://forums.microsoft.com/MSDN/default.aspx?SiteID=1>

Microsoft TechNet Script Center:
<URL:http://www.microsoft.com/technet/scriptcenter/default.mspx>

Outlookcode.com:
<URL:http://www.outlookcode.com/d/index.htm>

The syntax of your code looks OK from a purely ECMAScript viewpoint,
however whether it should work or not in Outlook probably wont be
answered here.

[...]


--
Rob
Closed Thread