Is JavaScript supported in an email message?

Is JavaScript supported in an email message?

Answers:

Answer

http://en.wikipedia.org/wiki/Comparison_of_e-mail_clients

Old clients, such as Lotus Notes, Mozilla Thunderbird, Outlook Express, and Windows Live Mail all seem to have supported some sort of JavaScript execution. Nothing else does.

It seems like a bad idea security-wise, so I would expect this to be a feature that won't always be around, even in these clients.

Answer

Other answerers have suggested that the answer is "No."

On the other hand, an html attachment will probably get opened in an environment that runs Javascript.

EDIT: It was suggested that I haven't properly answered the question so here goes a more complete effort.

Summary: I would expect that many or most users receiving an html-formatted email containing embedded Javascript will see it run and have run tests to confirm that this is true in some environments. But Javascript WILL be blocked for some users.

The protocols (specifically RFC2854) explicitly address scripting (within the text/html message body type) with the statement that:

In addition, the introduction of scripting languages and interactive capabilities in HTML 4.0 introduced a number of security risks associated with the automatic execution of programs written by the sender but interpreted by the recipient. User agents executing such scripts or programs must be extremely careful to insure that untrusted software is executed in a protected environment.

So the protocols do support Javascript, but which user agents do?

My (ancient) email reader uses a table to specify which viewer software to use for each mimetype, diverting html content to my favorite web browser. Almost all current web browsers support Javascript (and some issue dire warnings when you try to turn it off!) Do modern email agents include internal html interpreters and, if so, is the javascript turned on or off? I've checked documentation on Thunderbird and find that javascript seems to be turned on by default but can be turned off: http://codeverge.com/mozilla.support.thunderbird/simple-html-tags-reference-docume/2030160

I have noticed that some (?many?) users now access their email from a browser directly (webmail is one such platform) rather than running separate email software. All such platforms which I have tested so far do run any Javascript embedded in the html of the email message. However some such environments, depending on user security settings, do not automatically fetch external links (Javascript or pictures or other) and so can only run external Javascript from a file which is included as an attachment to the message. The same would be true of any offline email reader on a device without a current internet connection.

The above applies to javascript embedded in the main message part of the email body. One can also have html explicitly given as an "attachment", which if saved and then opened would be displayed in a web browser, wherein Javascript is available with very high likelyhood. Therefore, one might included a second copy of the javascript enabled email as an html attachement with an alternative text/plain main body and/or tag in the main text/html directing the user to the attachment.

I've been thinking about this because some of my acquaintances insist on sending me "email greeting cards" which consist of a text message directing me to a link which I've found so unsatisfactory that I refuse to even consider loading it just on principle. I have written and sent email greeting cards with interactive graphics and music and even games using embedded javascript and been satisfied with the result.

Therefore, I maintain that the correct answer is "Yes" both on the grounds that the protocols specifically address scripting and on the grounds that all the email agents I personally use ran the Javascript in my test emails.

Answer

No, generally speaking email readers do not allow javascript.

Answer

You aren't going to get executable JavaScript onto a server and into a mail client. But emails DO support links, you can always link to your content within an email.

Answer

Short answer

No


Descriptive answer

It depends. But the email is not guaranteed to behave in the way you want it to. Different email clients handle JS differently. Most of the newer email clients do not support any of it since it is potentially very dangerous to support script execution in a desktop application which contains so much of your personal info.

I had a use case where I needed to use JS in an email. I tried out on the web client of outlook and desktop client as well, and it turns out outlook just wipes out the script part of your HTML email. There might be some other email client which does support JS execution, but given that you cannot control the client where your email would be viewed in the client machine, it's not a good idea to embed any scripts in the HTML email.

Its advised to keep your HTML email as simple as possible, no JS, and the least CSS you can do with (because, again, different email clients have varying support for CSS as well) eg: outlook's web client was not even recognizing an HTML button tag in the email. I had to use an anchor tag and some CSS on top of it to mimic the display of a button.


Bottom line - don't rely on Javascript when working with HTML email content.

Answer

For most mail clients, no.

Answer

It may be, but mail clients won't read it & mail servers may reject it. So leave it out.

Answer

Javascript is not supported in emails.

Answer

The answer is yes, because email can carry any sort of message, JavaScript included.

Whether you will find an application that is willing to execute JavaScript within an email is another issue.

Answer

You can view an email with JavaScript working with Windows Live Mail, but can't add JavaScript to a new email you wish to send. JavaScript also works with saved .eml files. Mozilla Thunderbird version 60.7.0 can't view or add JavaScript. (If you save an eml file with Thunderbird, the code will work if file is then loaded with Live Mail) You can send an email with JavaScript using PHP code. Some email websites may support it, but the few I used don't. (AOL, uk2.net, GMail)

Answer

No email client support javascript due to security concern

Try to send mail with this html content

     <!DOCTYPE html>
     <html>
     <body>
     <button onclick="this.innerHTML=Date()">The time is?</button>
     </body>
     </html>

Tags

Recent Questions

Top Questions

Home Tags Terms of Service Privacy Policy DMCA Contact Us

©2020 All rights reserved.