Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

how to send javascript in email body part using c#

Posted on 2006-11-16
9
Medium Priority
?
2,761 Views
Last Modified: 2008-01-09
sending email from c#. in body part of email i require to call one java script function ,how to call that function?
0
Comment
Question by:polythought
  • 3
  • 2
6 Comments
 
LVL 5

Accepted Solution

by:
DoctorMahdi earned 336 total points
ID: 17956458
call it normally
<body>
        <SCRIPT LANGUAGE="JavaScript" src="javascript/polythought.js">
        </SCRIPT>
0
 
LVL 8

Assisted Solution

by:adg080898
adg080898 earned 332 total points
ID: 17959382
The format of the email must be HTML for DoctorMahdi's suggestion to work.

This might answer your question a little more accurately:

<SCRIPT LANGUAGE="JavaScript" src="javascript/polythought.js">
</SCRIPT>

<SCRIPT LANGUAGE="JavaScript"><!--
TheFunctionCall();
// -->
</SCRIPT>

Note that you have to use two separate script tags. If a script tag contains "src=" then the content of the tag is executed only if the js file is not found.
0
 
LVL 8

Expert Comment

by:adg080898
ID: 17959405
You could skip the first script tag if you just put the function right there in the email:

<SCRIPT LANGUAGE="JavaScript"><!--
TheFunctionCall();

function TheFunctionCall()
{
   // ... the code...
}
// -->
</SCRIPT>
0
What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

 
LVL 9

Assisted Solution

by:alkisg
alkisg earned 332 total points
ID: 17959728
Usually mail programs have javascript disabled.
In thunderbird it is possible to enable it, in Outlook / Express it's not, so it won't run no matter how you write it.
0
 
LVL 8

Expert Comment

by:adg080898
ID: 18398179
Looks like I was wrong about the javascript in emails - never have tried it myself and it makes sense to not allow it in emails since it would be easy to lauch a url to notify some server that the message was read. However, simply putting an image link in an email can do that for you. I'm not sure I was wrong, but I probably was.

I suggest either award alkisg the points or a refund.
0
 
LVL 9

Expert Comment

by:alkisg
ID: 18400976
> However, simply putting an image link in an email can do that for you.
That's why recent email clients like Outlook forbid automatic image downloading.

Javascript is disabled for safety as well - a .js script could fool the user to open a virus attachment, or use IE vulnerabilities to access the disk etc. Firefox has better organization for script security permissions, and that's why there is an option in Thunderbird to allow javascript (it's not as unsafe as IE).

As for the points, I'm not interested in them, just want to help whenever I can. I leave it up to the Cleanup Volunteers / moderators.

Regards,
Alkis
0

Featured Post

Concerto Cloud for Software Providers & ISVs

Can Concerto Cloud Services help you focus on evolving your application offerings, while delivering the best cloud experience to your customers? From DevOps to revenue models and customer support, the answer is yes!

Learn how Concerto can help you.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

We live in a world of interfaces like the one in the title picture. VBA also allows to use interfaces which offers a lot of possibilities. This article describes how to use interfaces in VBA and how to work around their bugs.
If you are a mobile app developer and especially develop hybrid mobile apps then these 4 mistakes you must avoid for hybrid app development to be the more genuine app developer.
An introduction to basic programming syntax in Java by creating a simple program. Viewers can follow the tutorial as they create their first class in Java. Definitions and explanations about each element are given to help prepare viewers for future …
Progress

824 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question