git clone https://github.com/younes-alturkey/form-api.gitnpm inpm run startRuns on http://localhost:5000.
IMPORTANT NOTE: First field or FormData append is reserved for the subject of the email and is excluded from the email body. Second field or FormData append is reserved for the cc list is excluded from the email body. This has to be a JavaScript array of strings. [""]
var formdata = new FormData();
formdata.append("subject", "Email Subject: New Form Submitted");
formdata.append("cc", "[\"[email protected]\", \"[email protected]\", \"[email protected]\"]");
formdata.append("name", "Younes Alturkey");
formdata.append("email", "[email protected]");
formdata.append("phone number", "+966538654514");
var requestOptions = {
method: 'POST',
body: formdata,
redirect: 'follow'
};
fetch("https://ya-form-api.herokuapp.com/[email protected]", requestOptions)
.then(response => response.text())
.then(result => console.log(result))
.catch(error => console.log('error', error));Or
<form action="https://ya-form-api.herokuapp.com/submit/[[email protected]]" method="POST">
<input type="text" name="subject" value="[EMAIL_SUBJECT]" style="display: none;"/>
<input type="text" name="cc" value="[\"[[email protected]]\", \"[[email protected]]\", \"[[email protected]]\"]" style="display: none;"/>
</form>Add your fields after these two.
The form supports file upload.