This is a repo for a starter server for sending emails to yourself or others through gmail using the nodemail node module. Follow the installation steps below to setup the server.
- Download the repository
- Install npm modules:
npm install
- Start up the server:
node server.js
- Test with POSTMAN or connect using Jquery AJAX from your front-end
An example of how to connect and pass information to the server from the front end:
//THIS IS JQUERY
$.ajax({
url: 'http://localhost:3003/email/send',
headers: {
'Content-Type':'application/x-www-form-urlencoded'
},
method: 'POST',
crossDomain: 'true',
dataType: 'json',
data: {'email':email,'password': password, 'number': phonenumber},
success: (data)=>{
console.log('YOU SEND THE DATA TO THE BACKEND!')
}
}) .fail(function(jqXhr) {
console.log('failed');
});
If you have any questions hit me up on slack.