Vue sending email [duplicate] - javascript

This question already has answers here:
How to send an email from JavaScript
(20 answers)
Closed 4 years ago.
I have a problem. I want to put a contact form on the page, but I do not know how to do it in the Vue. I wanted to do it normally as jquery, php, but it does not work in Vue. Does anyone have an idea what I can do?

Vue is a View (hence the name) library, meant for describing your View layer i.e. how your application looks. Such logic as sending an email would for one be dependent on Javascript itself and not on Vue.
However it is not possible to send an email from Javascript in the browser. Instead you'd need to build a backend which can send an email for you, or you could call the user's email client, both described here.

You would ideally send email data (to, message body - html escaped of course) as a request to a backend end point and send from there. You can use Vue's HTTP resource to send the request: https://github.com/pagekit/vue-resource
But sending an email directly from Vue isn't possible.

Related

Validate if email address exists in JavaScript [duplicate]

This question already has answers here:
Can I perform a DNS lookup (hostname to IP address) using client-side Javascript?
(16 answers)
Closed 4 years ago.
I need to check whether my email address has valid host, exist for example someone#yahoo.com might return valid meanwhile some#yahozzz.com might return invalid (because invalid host)
I stumbled upon a code in git for golang that satisfy my needs for that https://github.com/badoux/checkmail, but currently at the moment i'm looking for the solution in javascipt, any help will be appreciated.
P.S. : I am using this code as a script inside my HTML
Actually to verify that an email exists and is active you have to send a message to the email server and check the response.
That cannot be done entirely in javascript although you can rely on a service instead than on your backend like this

Why should I use POST etc methods instead of URL parameters? [duplicate]

This question already has answers here:
When do you use POST and when do you use GET?
(27 answers)
Closed 6 years ago.
We can accomplish the same thing by doing:
localhost:3000/endpoint?var1=val1&var2=val2
That we can do by using POST with a JSON body.
So why should anyone use PUT/POST/PATCH if they can get the same goals by using url params? Even with auth, instead of header, you can send the information of the auth token back and forth by using a parameter?
one reason is that GET parameters have to be URL-encoded.
then there are limitations of URL length documented in RFC I think.
This will make it difficult when transfering large data (e.g. file uploads,...)
additionally, developers may want to hide some informations from the user, to prevent users to bookmark a page with all these parameters...
Definitely NO reason for POST args is security on the transport layer. in both cases the data are plain text in HTTP, and both (also the URL) are encoded end-to-end when using a secure HTTPS connection.
It is more secure, because your data is encrypted and sent in the header of the request.

How to add a javascript value into my SQL table? [closed]

Closed. This question needs debugging details. It is not currently accepting answers.
Edit the question to include desired behavior, a specific problem or error, and the shortest code necessary to reproduce the problem. This will help others answer the question.
Closed 6 years ago.
Improve this question
I'm kind of new to javascript but I'm currently working on my website:
When I press a button, javascript generates a random number (for example: Your Coins: 25) and then I need to connect to my 'members' table and add 25 to the 'coins' field. (I'm already connected with mysql in the php code if this matters.)
Could anyone help me?
If it's "coins" then you probably won't want it to generate client side, otherwise someone would be able to call your java script function with any number they like and add in millions of coins!
The other way is to have PHP generate the number for you.
You can use something like jQuery's $.get function to call your php script with the action of "adding a random number of coins" and the php script can return the random number to java script via JSON for it to be displayed.
First the browser sends a request to the server, which, on its turn parses it. This is the time when your HTML is generated and your PHP runs. When the HTML is generated and ready, it is being sent to the web-browser. The HTML might contain script tags which are pointing to js files via the src attribute, or script tags which contain Javascript code, but before the server sends the response, the Javascript files are not loaded, Javascript code inside the scripts will not be executed. When the response arrives to the web-browser, it parses the HTML, loads the external js, css files and pictures and executes the Javascript code.
So, when your Javascript generates the value, it is running on the user's web-browser, remote from the server. Therefore, from this point the Javascript code should send an AJAX request to the server. This will post a request to the server, which, on its turn will receive and parse it. You can post parameters when you send an AJAX request. jQuery has an easy-to-use variation. Your server will receive the request with your parameters and you will be able to read the parameters via $_GET or $_POST, which are associative arrays containing parameters with their names used as indexes. You can use those to write your query.
All this is well-documented, if you watch a few tutorials, you should be able to solve the problem. On the other hand the commenters and the other answerer are right when they tell you that you should never trust the browser to generate sensitive data, as hackers could easily see what requests are being sent from the web-browser and would send similar posts where they would be "lucky".

How to send an email in javascript? [duplicate]

This question already has answers here:
How to send an email from JavaScript
(20 answers)
Closed 7 years ago.
I am making a simple website, but to save I am making it send some text to an email using javascript.
I want to make it send directly, but if there is no way to do that it would be fine if it sends by going to the email site.
My code so far looks like this:
var a = function(){
var b = document.getElementById("email").value;
document.getElementById("textarea").value.mailto=b;
};
I want the code to send the value of the textarea.
You should have a server somewhere which listens to email sending commands. Your Javascript should send an AJAX request to that server, passing the necessary data and triggering the email sending functionality. The server, in turn should send the email(s) and respond to the Javascript part to notify the client-side whether it was successful.

Finding Dynamically generated parameter values to be sent with http post method to login

I want to login to hotmail email account with httpclient. For that I need to pass 21 parameters to http post method including username and password. I found this out through temper data addon in firefox. I also found out that few of them are generated dynamically.(i.e. their values change each time we reload the page). My problem is to how do I find these dynamically generated values of the parameters which have to be passed in http post. I tried to find them with firebug addon but it did not help ! I think values are generated by javascript. If it is, then how do I parse them ? I have used Html parser before but it seems that it does not support javascript parsing. I would appreciate any idea regarding this.
Thank you.
This might be some form of CSRF anti forgery token, in which case I don't think you going to come right. They might be stored in some cookie, or in a hidden element in the page.
More info: http://blog.stevensanderson.com/2008/09/01/prevent-cross-site-request-forgery-csrf-using-aspnet-mvcs-antiforgerytoken-helper/

Categories

Resources