Data sent to email on HTML form submit - html

I want to create a feedback form where the users input data and when they press submit button, all the data entered is received by the admin at an email address which has been predefined in the code.
i don't want to use "mailto" as it opens another service. Is there any way to send data to email through the HTML form itself?

Forms send data to the URL specified in the action attribute.
mailto: URLs, which you have sensibly ruled out, are highly unreliable.
The only other kind of URL which can be usefully used is an http(s) URL where it is then processed by server side code.
If you want to send the emails to a different address then you need to change the server side code so it doesn't use a single address.

After a lot of research, I have decided to use https://formsubmit.co for this purpose. The details are present in their documentation.
It was exactly what I wanted, and completes my requirements. Thank you to everyone for their help.

Related

Don't submit all form fields

I'm working on a project that I'm using stripe to handle payment processing, as part of this I've created a form for collecting card information, my problem is that I want to submit some of the data to be sent to my server (like name and email address), but other parts (the card details) I don't since they're processed by stripe so there's no point sending them to my server.
I'm not sure how I can do this though, since the input fields that I do and don't want to send are all mixed together, so I can't just wrap the parts I do want in the form tag and not the rest.
Is the a flag on a form field that I can set so that it isn't submitted with the form?
Any help would be greatly appreciated.
Using Javascript or Ajax may be the best way
Get values and trigger for differentes urls
Check this link: send specific part of the form fields to server using ajax?

What does the submit button do, and how do you make a signup for newsletter with it?

I've been coding a website, it's nearly finished but I want users to be able to sign up for a newsletter. I've found that you can use the submit button but I don't know how to. How do you get the button to email you the information? Any help appreciated, thanks.
Typically the page contains a series of input elements ( think text boxes etc) which the user puts their data in to, the submit button POSTs a form to the server, the server can then access those form values and use them as required.
So in your scenario the server received an email address and name, for example, and you have an email library which can send that information to you. Alternatively of course you might put that information in a database so you can more easily handle subscriptions.
Look at this tutorial how get user email and save in database.
http://www.informit.com/articles/article.aspx?p=1924985

How Do I Create an html email button that will send back to me an emailed response?

I have a small ecommerce business and from time to time a customer will say that they never ordered the item and I am forced to refund their money due to lack of any confirmation from the customer as to his actually placing the order.
I would like to add either an hmtl button or any sort of tool to the emails that i sent you with the customer's receipt. The customer will get the email with his receipt and also within the email will be a button ("I approve This Transaction") for him to click on that will send me back a confirmation email.
Please advise.
Thanks,
Don
There are 2 ways to do this.
With a mailto: link, this would open the users default email client where they would have to send the email as an extra step.
URL parameter in a normal href/button link (ie: www.yoursite.com/yourpage.php?email=their#email.com). You would link to a webpage (yourpage.php) that would pass that URL parameter (in this example "email", but can be any other info you pass through) you can then parse that URL parameter in your webpage and have it email you automatically based on that info.
Option 2 is the way to go, but requires some coding knowledge (PHP for example). Also, in order to set up unique URL parameters, you'll need a system that uses merge tags to create unique values for each email you send. I'd suggest you should use a transactional email service provider for this.

Can a malicious user submit data if there is no form?

In my site, users can only modify their personal information only once a day. Script-side, I determine if they are allowed to (i.e. check with the database if it's been 24 hours since the last modification) and whether or not to display the form.
My question is, could a malicious user manage to submit information if there's no form? In other words, if there is no FORM element no data should be submitted by the user's browser, right?
What I'm afraid of is that if someone manages to send the data, the script would still process it and change the personal information when it shouldn't.
Of course - this would be a kind of replay attack. So long as your resource endpoint will handle a malicious POST request, regardless of the content of the preceding GET then you're vulnerable.
Remember: never trust the client. Provided that you do authentication and authorization checks before handling a POST request then you'll be fine.
Yes, a malicious user can still send data even without the form, if he knows the url of the page which accepts the data and their corresponding attributes it expects. He can then easily create a form with that info and submit the data.
So you basically need to validate the data at the server-side.
YES
For example someone could use curl.
curl -d profile=value http://www.yoursite.com/profile
You could prevent such attacks with a CSRF token you send along with your form.
See this article for more background http://shiflett.org/articles/cross-site-request-forgeries.

Can we send mail using HTML static page

i have made a static site with only html static pages but now i want a contact us from where in one can recieve the info entered by user via mail.so, basically i want to know whether i can send email using HTML like using javascript or something if yes then please help.
You can't send an email with just HTML (From the Front-End) unless you don't mind interacting with a third party service provider which can do the back-end process for you.
Otherwise, you need to use the Back-End, the most common and easiest way to do this is with PHP.
Your "send mail" code would ultimately have to execute on the server, which requires a postback from the HTML page, but the HTML page (or its (script) contents) can't (and shouldn't, even if possible) use local (the user's) settings and facilities to send email.
NO! JavaScript can’t email a form! but, there are alternatives to send the form data to an email address.
PHP mail() function is the best in my eye. Read more about it here: PHP mail() function