-1
Good morning gentlemen, I am beginner in Node and Javascript in general, I am using express.js and I want to press the button "SEND" it runs a code (that serves to send an email):
The code Node I want to run when pressing the button:
const nodemailer = require('nodemailer')
function emailSend() {
let transporter = nodemailer.createTransport({
host: "smtp.gmail.com",
port: 465,
secure: true,
auth: {
user: "[email protected]",
pass: "senha321" //nao 'e meu email kkkkkk
}
})
transporter.sendMail({
from: "Herbert Richard <[email protected]>",
to: "[email protected]",
subject: "Teste de envio de email",
text: "Ola, sou hebert richard e estou testando o nodemailer"
}).then(message => {
console.log(message);
}).catch(err => {
console.log(err);
})
}
My express:
const express = require('express')
const app = express()
app.get("/", function(req, res){
res.sendFile(__dirname + '/src/index.html')
})
app.get("/style.css", function(req,res){
res.sendFile(__dirname + "/src/style.css")
})
app.get("/runeterra-logo.png", function(req, res){
res.sendFile(__dirname + '/src/runeterra-logo.png')
})
app.get("/wallpaper.jpg", function(req, res){
res.sendFile(__dirname + '/src/wallpaper.jpg')
})
var server = app.listen(3000);