Link to home
Start Free TrialLog in
Avatar of polythought
polythought

asked on

how to send javascript in email body part using c#

sending email from c#. in body part of email i require to call one java script function ,how to call that function?
ASKER CERTIFIED SOLUTION
Avatar of DoctorMahdi
DoctorMahdi

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of adg080898
adg080898

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>
SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
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.
> 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