Mailer with reCaptcha validation using ExpressJS
- NodeJs
git clone https://github.com/dim4k/ExpressMailer.git
At the root of your project, run :
npm install
Open conf.json-dist, change this configuration file according to your setup and rename it to conf.json
At the root of your project, run :
node server.js
Here is a simple example of ajax call to the mailer
$('.submit-form').click(function(){
var data = $('.form').serializeArray();
data.push({'name':'userId','value':'yourId'});
$.ajax({
data: data,
type: "POST",
url: "http://localhost:3000/sendMail",
success: function(data){
alert(data.responseDesc);
},
error: function (xhr, ajaxOptions, thrownError) {
console.log(xhr);
}
});
});
Assuming the form got the following fields :
- firstname
- lastname
- message