Java scripts not working in html email template

2019-03-07 07:09发布

I have a scenario where I need to send an email using c#, which could be easily done using SMTP, but the challenge is to incorporate web service in the html mail, hence i have used java scripts inside mail body to access the web service when a button click is raised.

As a html(Web Page), it works perfectly good but then when i send a mail and try with the click of a button in my mail, the onclick not raised the jscript and hence no action has happened and it was actually disabled.

I checked with the firebug(in firefox) in the particular html tag, to my surprise the jscript tag was not present there hence the event was not raised. My question is can we access web service in html email? and don't JScripts works on Gmails?
Does the html email do only the redirecting, using href... To my experience i have never got any mail which uses java scripts(like click of a button zooms the image in the same page, which is very much possible in html,asp pages).

Thx in advance...

3条回答
劳资没心,怎么记你
2楼-- · 2019-03-07 07:41

I'm not aware of any email client or web mail service that will execute JavaScript embedded in an HTML email.

Limit HTML use in emails to formatting. If you need an web application, then link to it instead.

查看更多
Evening l夕情丶
3楼-- · 2019-03-07 07:59

You can't automatically call a web service from an e-mail letter. You have to create an URL for the recipient to open, and let them access the web service from a web page in the browser.

JavaScript, and any other third party communication method for that matter, is disabled in any reasonable e-mail client by security reasons.

查看更多
一夜七次
4楼-- · 2019-03-07 08:05

Apart from struggling to understand the question, Javascript won't work in most mail clients. Deliberately disabled.

查看更多
登录 后发表回答