473,785 Members | 3,417 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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.t xt"
var attach2 = "c:\\test.t xt"
var attach3= "c:\\EmailTempl ate.htm";

//Create Outlook Object
oOutlookApp = new ActiveXObject(" Outlook.Applica tion");
oDoc = new ActiveXObject(" Word.Applicatio n");
//Create Outlook Message
oOutlookMsg = oOutlookApp.Cre ateItem(0);
oOutlookMsg.Bod yFormat = 2;

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

oOutlookMsg.To = sText + "@inovex.ca ";
oOutlookMsg.Sub ject = "test";
oOutlookMsg.Bod y = oDoc.ActiveDocu ment.Content;

oOutlookMsg.Att achments.Add(at tach,1);
oOutlookMsg.Att achments.Add(at tach2,2);
oOutlookMsg.Att achments.Add(at tach3,3);

//Send Email
oOutlookMsg.Sen d;

Jun 1 '06 #1
1 8813
je********@inov ex.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.microsof t.com/MSDN/default.aspx?Si teID=1>

Microsoft TechNet Script Center:
<URL:http://www.microsoft.c om/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
2115
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 format. The text/plain section of the message source is left empty. Therefore some mailclients cannot display the body, so recipients think they receive
4
6318
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 href=\"fadfaf\">anchor</a>blalbababa</span>"
385
17316
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 extraneous jargons, such as in the Unix & Perl community. Unlike mathematicians, where in mathematics there are no fewer jargons but each and every one are
2
8403
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 submitting the form to update the database. The server doesn't have the client side value any more. It seems to me that as I begin to write the client side javacript code for form validation and client side editing capabilities in order to save...
5
11043
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 similar. I'm succeeding in doing this by using Writer.Write to emit my HTML, at least as far as getting it to work. However, depending on where I put MyBase.Render(Writer), I get my HTML either before the header or after the end of the body of...
17
2496
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 'Button19' of type 'Button' must be placed inside a form tag with runat=server Can the IDE not do what it is supposed to do. It seems that it is a fight to make it do anything or did I do something wrong? It would seem silly to have to create a...
1
2333
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 HTML and the message looks like crap. How can I force the message to open in the Outlook HTML editor? Thanks, Scott Dim myOlApp As Object Const olMailItem As Integer = 0
12
2272
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 errors show up in your error-list, you can disable this functionality by selecting the Tools->Options menu item in VS or Visual Web Developer. Select the TextEditor->Html->Validation tree option in the left-hand side of the
4
2012
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 contains a <formthat should be submitted to an external ASP page. The <formtag naturally cointains a target=_blank and a proper action.
0
9643
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
10315
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
10147
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
10085
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
9947
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
1
7494
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 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 a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5379
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
1
4045
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
3645
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.