Problems with nodemailer

Hi there!
A few days ago I was able to learn to use nodemailer and confirm to send me an email with data from the body of an html. Now I want to integrate this into a project that I am starting and for some reason it does not take the POST route that I have created for said event. Any help is welcome.

Here is the repository with the code:

Thank you

Hey welcome! You should put it up on Glitch so it’s easier for someone to remix it. Also…it’s Glitch’s forum :slight_smile:

Here is the app

const express = require ('express');
const path = require('path');
const swig = require('swig');

const contactoRouters = require('./routes/contacto');

const app = express();

app.use(express.urlencoded({extended: false}));

app.use(express.static(path.join(__dirname, "public")));
//app.set('view engine', 'ejs'); ACA ESTÁN LOS DOS ENGINES, EJS Y PARA HTML.
app.engine('html', swig.renderFile);
app.set('view engine', 'html');
app.set('views', path.join(__dirname, 'views'))


app.get('/', (req,res) => {

app.use('/contacto', contactoRouters);

app.get('*', function(request, response){
      code: '404',
      error: 'Página no encontrada'

  app.listen(3000, () => {
    console.log('El server trabaja en el puerto 3000')

the contacto route

const express = require('express');
const router = express.Router();

router.get('/', (request, response) => {
})'/send-email', async (req, res) => {
  const { name, email, phone, message } = req.body;
  contentHTML = `
      <h1>User Information</h1>
          <li>Username: ${name}</li>
          <li>User Email: ${email}</li>
          <li>User Phone: ${phone}</li>


const transporter = nodemailer.createTransport({
      host: '',
      port: 465,
      secure: true,
      auth: {
          user: ``,
          pass: `****************`
          rejectUnauthorized: false

const info = await transporter.sendMail({
      from: '"Server Gmail" <>',
      to: '',
      subject: 'Mail de prueba',
      html: contentHTML

console.log('Message sent', info.messageId);


/*transporter.verify().then(() =>{
  console.log('Ready for send emails');

module.exports = router;*/


module.exports = router;

Ande the view contacto

<!DOCTYPE html>
<html lang="en">
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <link rel="stylesheet" type="text/css" href="main.css">
    <script src="" crossorigin="anonymous"></script>
    <title>La Peligrosa-Contacto</title>

    <div class= "containercontacto">
        <nav class="nav">
            <button class="botonhome">
                <a href="/">
                    <i class="fas fa-home fa-2x"></i>
            <img class="logo" src="/assets/5296e1c98737878b714cf027c02cdefb.jpg">
            <ul class="lista">
                <li>Próximos Remates</li>
                    <a href="productos.html">Nuestros Productos</a>
                <li>Cabalgatas Turísticas</li>
        <div class="maincontacto">
            <ul class="listacontacto">
                    <div class="whasap">
                        <i class="fab fa-whatsapp-square fa-2x"></i>
                        <p>Whatsapp - 093 967 602</p>
                    <div class="facebook">    
                            <a href="">
                                <i class="fab fa-facebook-square fa-2x"></i>
            <div class="menssage">
                <form action="send-mail" method="POST">
                    <input type="text" name="name" placeholder="NOMBRE">
                    <input type="text" name="mail" placeholder="CORREO">
                    <input type="text" name="phone" placeholder="TELÉFONO">
                    <textarea name="message" class="message" placeholder="DEJA TU MENSAJE AQUÍ... " id="message"></textarea>
                    <button class="botonenviar">ENVIAR </button>
        <div class="footer">@2021</div>

Ty Christina :slight_smile:

This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.