简体   繁体   中英

Send an e-mail automatically with data from a form

I need some advice in order to generate automatically an email that sends the answers from a form to my email adress.

We used the mailto method included in the html API, but it just opens a mail window, we would like to trigger the sending of the email by clicking on the validation button of the form.

<form>
<input type="checkbox" id="item1" name="interest" value="item1">
<label for="coding">Male</label>
<br/>
<input type="checkbox" id="item2" name="interest" value="item2">
<label for="coding">Female</label>
<br/>
<input type="submit" name="Submit" value="Submit">
</form>

Thank you for your time !

This is not possible with client-side code alone. If it were possible, then any website could use every visitor's browser to send any email to any email address. That would be a spammer's dream.

You must send the data over HTTP to a server (this is most easily done by using an HTTP URL in the action attribute, but you could also look to JavaScript (Ajax)) and then use server-side code to send it.

The specifics of the server-side code will depend on your choice of programming language.

You might also seek out a third party service which will provide a pre-existing HTTP endpoint hosted on their servers which you can use.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM