473,322 Members | 1,494 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,322 software developers and data experts.

Insert HTML into Outlook message with Javascript

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;

Jun 1 '06 #1
1 8796
je********@inovex.ca wrote:
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.


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
Jun 2 '06 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

0
by: Ruud vd Velden | last post by:
Hello, We're using Office XP on Windows 2000 SP4. After installing the Oracle Connector for Outlook the following problem occurs: Emails sent by Outlook, in HTML format, do have a strange...
4
by: Sergio del Amo | last post by:
i, I have the next html page <html> <head> <script> <!-- function insertcode() { var code ="<p> blablabal babala babababab</p><h1>here comes header</h1><span>fadfafa<a...
385
by: Xah Lee | last post by:
Jargons of Info Tech industry (A Love of Jargons) Xah Lee, 2002 Feb People in the computing field like to spur the use of spurious jargons. The less educated they are, the more they like...
2
by: Hazzard | last post by:
I just realized that the code I inherited is using all asp.net server controls (ie. webform controls) and when I try to update textboxes on the client side, I lose the new value of the textbox when...
5
by: Rick Spiewak | last post by:
I need to generate a "buy" button as part of an ASP.NET page - this consists of a small HTML form with hidden fields, conforming to the requirements of a merchant credit card processor. PayPal is...
17
by: Lloyd Sheen | last post by:
This IDE is driving me nuts. I needed another button so I copied an existing one, changed the Text and the id and position by drag and drop. Well then I run and get the following: Control...
1
by: Scott Emick | last post by:
I am using the following code. When outlook opens the message and the Outlook HTML editor is the default editor, there is no problem. If Word is the default editor, however, it butchers up the...
12
by: Nalaka | last post by:
Hi, I suddenly started getting a lot of errors from html validation (some CSS) so I followed the following instructions to disable it. If you'd rather not have these types of HTML validation...
4
by: newcomsas | last post by:
Hallo. I'm working on an email message sent in HTML format. As the email reach the adressee the HTML is correctly visualizaed (I made sever tests with Outlook 2003). The fact is that the code...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
1
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.