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...
Apart from struggling to understand the question, Javascript won't work in most mail clients. Deliberately disabled.
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.
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.
Related
I want to send a email automatically with JS.
I use the next code to open a window with outlook with a mail with the information that I want.
Now I want to send the mail with JS. I need to "click" the send button automatically of the Outlook interface. Any ideas? Maybe with an Ajax /JQuery?
If anyone knows other process to send emails automatically with JS its usefull for me too.
function main(){
location.href = "mailto:"+'someone#something.com'
+'?cc='+" "
+'&subject='+'something'
+'&body='+"Hi, im an automatic mail";
}
To details
Please note, JS is client side and runs inside browser, you do not have access to any application or file system outside browser or to browser itself..
Further,
If you need to send automated emails, you will need server side email engine configured and will need to make ajax / jQuery call to engine with recipient details..
We are using zapier's webhooks to collect answers we gather via html5 formatted mail messages. The mail is created with zapier and includes some dynamic info and two buttons to make your choice. These button actions are each linked to a different webhook. The webhook provided by zapier has a static part and a dynamic part which is a zapier variable. When the receiver pushes the button, a blank browser window shows up with, whether a short text or in "silent mode" a blank page.
Although we are sending an extra mail as confirmation for the decision made via mail, we would like to either avoid the showing of this blank page at all or maybe replace it by a customized HTML page that shows a more attractive web page.
We tried different approaches like using an additional javascript onlick action on the button to achieve the opening of two pages with one click. One with the webhook blank page as the trigger and another one with a nice confirmation message page for a nice user experience. Unfortunately, there are some mail client limitations that seems not to allow javascript executions.
Is there any workaround like using any third-party service that offers webhook containers with the possibility to customize the content of the page linked to the webhook URL or any idea on how to link a button action to two url’s?
Thank you for reading this long question. Any help would be greatly appreciated.
David here, from the Zapier Platform team.
I can't speak to other options, but the best choice for you here is probably to have the email link go to a static page with two buttons. That way, you'll be in the browser and can do whatever you need with JS. This is likely buttons that have onClick handlers and then show nice confirmations.
It also avoids false clicks, where a mail client tries to load external resources (which normally doesn't matter, but in this case can trigger a webhook).
I am developing a web application using Facelets and Entity-Controller-EJB structure. In the application, there are contents which are reachable only if you are logged. A bean checks the login state every time you click on a button/link for the restricted contents, and redirects you either to the selected page or to the login page.
I thought that this way is not safe, as you can write the link directly in the browser instead of generating it from a button that checks the bean. So what should I do? Is there a render option embeddable in each page or should I write a javascript function? In this case, what should I do? I have studied js fundamentals but don't really know how to implement this control!
Thank you for reading!
You cannot rely only on frontend to deny access to some parts of a web application.
This because all the HTML/CSS/Javascript is downloaded on users' browser, so they can read your code and your authentication mechanism, and understand how to bypass it (or just disable it).
More on this: Why are browsers allowed to display client-side source code?
What you need is implementing some security mechanism in the backed.
The simplest one is to delegate this to your webserver (here the instructions for Apache) and then use something similar to this to do login.
Another way is to have a proper backend: you send data to it (email/password) and it provides you a token that you use to access protected resources.
Or also, dinamically create your documents on server side, only if the user is authenticated.
I am developing a Javascript library to FluidDB HTTP API.
Since FluidDB API does not support JSONP I am forced to use AJAX and hence to develop a firefox extension to workaround AJAX's same origin policy.
My solution is to include a HTML file inside the extension. That HTML file displays a simple form where the user could enter the username, password and the other GET/POST data that forms a request.
I load the HTML file using the chrome URL.
When the user enters his username and password I want to store it somewhere persistently and spare him the trouble of having to enter it everytime. I tried creating cookies but it did not work as the webpage is not a valid domain.
Are there any alternatives?
Once I had the same issue "cookie-less Session Variables in JavaScript", while working on my project.so came across one method called window.name="some value",take a look of following link which i had digg during my project.Hope it will be useful for you..
please dont ignore the caveats.
cookie-less Session Variables in JavaScript
I only just ran across this question. FluidDB does (now) support JSONP:
http://doc.fluidinfo.com/fluidDB/api/http.html#support-for-jsonp
Terry
I want to email a web page through javascript. Its enough to open the outlook new mail option. I try to move a Here i am using mailto: option in html.
Actually i am try to create a dynamic email template and want to send that template in html format.
Its showing error "comment line argument is not valid. verify the switch you are using"
please get me the solution.
Javascript can't send e-mails. Your best bet is the e-mail me syntax. There is a convention that most browsers suppors that lets you set the contents of various attributes as well.
e-mail me
It will have to be URL encoded, and as far as I know, there is no reliable way to pass HTML. You have to assume plain text emails.
You really need the server's help to make this easier.
1) Have the server make an XMLHTTP request to the page that generates the HTML you want. Grab it and make it the mail body.
or -
2) Grab the innerHTML, stick it in a hidden textarea and post it back to the server. Use the posted form field in the mail body.
You need to do this server-side, not client side. Outlook is not going to allow you the control you need to use a template. And for good reason - you wouldn't want websites taking control over your Outlook and sending emails.
If you can tell us what server you're using, we can show you how to send the email server-side.
There are security restrictions which stop it working directly. Yes if you wanted Outlook specifically, you could start messing with ActiveX - but that is fiddly and limited certain operating systems , installations, and security settings.
It is much better to use a mailto: URL. This is then cross-platform, and supports any default mail client.