Is it possible to send a email to me, if my website gets a new input of input html element?
You can use nodemailer to do that.
This might work:
const nodemailer = require('nodemailer');
let transporter = nodemailer.createTransport({
service: 'gmail', //change this to the email provider
auth: {
user: 'emailtosend@gmail.com',
pass: 'emailpassword'
}
});
let sender = 'email@gmail.com' //Don't know html, so I manually defined them here, but you can use html to set these up.
let reciever = 'email@gmail.com'
var mailOptions = {
from: sender,
to: reciever,
subject: '<website name> html Input',
text: `Whatever you want`
};
transporter.sendMail(mailOptions, function(error, info){
if (error) {
console.log(error);
} else {
console.log('Email sent: ' + info.response);
}
});
2 Likes
Do note the text input accepts HTML, for more enhanced looking emails