473,509 Members | 10,100 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

send MIME email with HTML and javascript to Outlook

28 New Member
Hi All,

I use html to dump some statistics I collect from different servers, and them email this file via SMTP email.

Basically I email html pages with mime type

Expand|Select|Wrap|Line Numbers
  1. Content-Type: text/ html
  2.  
No I wish to add javascript to these html pages, to make them dynamic and more useful.

I have tried changing mime to
Expand|Select|Wrap|Line Numbers
  1. Content-Type: text/ javascript
  2. Content-Type: text/ javascript1.0
  3. Content-Type: text/ jscript
  4. Content-Type: application/ javascript
  5.  
but none of these are accepting the javascript code.

Also, setting mime to html display html part of code fine, but simply ignore the javascript code.

Expand|Select|Wrap|Line Numbers
  1. Content-Type: text/ html
  2. Content-Type: text/ html/ javascript [not sure how, but this work same as above LOC]
  3.  
I have checked on wikipedia that Outlook supports javascipt I am using outlook 2007.

Any help here..?

Thanks and Best Regards,
Aug 8 '11 #1
6 4776
Dormilich
8,658 Recognized Expert Moderator Expert
that depends upon how you serve the JavaScript.

external file: include as <script type="text/javascript" src="http://example.org/myfile.js">
internal section: <script type="text/javascript">

it may also depend on whether the UA (user agent => Outlook) supports JavaScript (you checked) and whether the use of JavaScript is enabled.

the MIME type of the HTML has to stay the same (i.e. text/html) since it is not JavaScript. if you reference the scripts correctly, the UA will take care of the script loading itself, just like Websites in a browser.
Aug 8 '11 #2
AIProgrammer
28 New Member
Thanks Dormilich!

I am presently serving the script as internal section only. (though if need be it is also possible for me to put it in separate file).

It is working fine in browsers, but not displaying correctly in Outlook. The contents are being sent as attachment (not email body) as a .js file. I am using SMTP email. Will use some other sort of emailing help (like IMAP or so)?

The scenario is that I will be sending some server stats to a list of people - they all use Outlook. Presently it is plain HTML. Adding javascript is the next step.

Thanks and Best Regards.
Aug 8 '11 #3
Dormilich
8,658 Recognized Expert Moderator Expert
IMAP is a protocol to read emails (not send).

I’m not sure if it is possible for Outlook to read JS from attached files (never done it because I hardly send HTML mails). you could try to serve the JS externally (via http://example.org/myfile.js instead of attaching)
Aug 8 '11 #4
AIProgrammer
28 New Member
Hi Dormilich,

Actually I am not attaching them..it is supposed to something like this. (I have not written the header here ..the content-type and mime headers etc)..let us consider I have to email this html + js code so that it can be read in outlook. Thanks for looking..

Expand|Select|Wrap|Line Numbers
  1. <html>
  2. <head>
  3.     <title>
  4. A web page
  5.     </title>
  6. </head>
  7.  
  8. <body>
  9.  
  10. <script language="javascript">
  11.  
  12. document.write(document.lastModified);
  13.  
  14. </script>
  15.  
  16. </body>
  17. </html>
  18.  
Aug 8 '11 #5
Dormilich
8,658 Recognized Expert Moderator Expert
the language attribute is deprecated, use the type attribute instead.
Aug 8 '11 #6
AIProgrammer
28 New Member
Thanks Dormilich..I have tried with that as well already.

Expand|Select|Wrap|Line Numbers
  1. <script type="text/javascript">
  2.  
  3. </script>
  4.  
Aug 8 '11 #7

Sign in to post your reply or Sign up for a free account.

Similar topics

5
14203
by: lucanos | last post by:
Hey All, I'm having trouble trying to create a PHP file which will generate a multipart email message (containing both an HTML formatted part and a Plain Text formatted part). I have Googled...
1
6999
by: John B. Kim | last post by:
I am working on the code below: ****************************************************** use strict; use MIME::Lite; use Net::SMTP; my $from = 'steve@earthlink.net'; my @addweek1 =...
0
3673
by: David Burson | last post by:
Hi, I have a VB.NET windows app that needs to automatically send a simple text email when my users run a new version of the app for the first time. I thought this would be simple, but after...
2
4878
by: amerar | last post by:
Hi All, We use Outlook as our email client, go figure. Anyhow, we have an application that creates a file and sends it to several people in ur company. They want the emails to have different...
5
2318
by: Thierry | last post by:
Hello. Is it possible to send an email with some HTML code ? I tried the following code, where $msg == '<html><body>... blah blab blah etc.</body></html>' : // Adresse de l'expediteur...
10
24351
by: Mike Charney | last post by:
Is there a simple way to send SMTP email from Access VBA? Mike m charney at dunlap hospital dot org
16
6991
by: anya | last post by:
Hey, I have a certain problem and till now I didnt find an answer on the web. I want to send an email message with picture in it. I dont want to put it as attachment but make it in the body of...
9
77407
by: Mahernoz | last post by:
Can i send an email from JavaScript? Is it possible? If yes please the code to send email using javascript...
1
1891
by: Matt Tonkin | last post by:
Hi: I need to automate outlook to send an email to me when my Outlook calendar is updated but i am not at my desk. I have written a code that will compile and tabulate my calendar for the day, place...
0
1504
by: Leon H | last post by:
I probably read all possible articles on the discussion forums about how to send email programmatically from Outlook, so below is my code. Basically, it executes just fine without exceptions or...
0
7237
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,...
0
7137
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
7416
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...
1
7073
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...
0
7506
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...
0
4732
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
0
3218
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...
0
1571
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 ...
0
443
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence...

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.