Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // app.post('/send', (req, res) => {
- // const output = `
- // <p>You have a new contact request</p>
- // <h3>Contact Details</h3>
- // <ul>
- // <li>Name: ${req.body.Name}</li>
- // <li>Email: ${req.body.Email}</li>
- // </ul>
- // <h3>Message</h3>
- // <p> ${req.body.Message}</p>
- // `;
- // let transporter = nodeMailer.createTransport({
- // host: 'smtp.gmail.com',
- // port: 465,
- // secure: true,
- // auth: {
- // user: 'henryzhengschool@gmail.com',
- // pass: 'dankmeme'
- // },
- // tls:{
- // rejectUnauthorized:false
- // }
- // });
- // // this is where you define the actual email you're going to send.
- // // note that the to, subject, and text fields all work with an object called
- // // req.body. req is your request variable and the body object is
- // // the body of the POST request sent by the user. In the case where
- // // you have a contact form, all the contact information from the HTML form
- // // will be inside req.body.
- // // It is suggested you console.log(req.body) before proceeding to understand
- // // what is inside this object.
- // let mailOptions = {
- // from: '"Nodemailer Contact" <henryzhengschool@gmail.com>', // sender address
- // to: "henryzhengschool@gmail.com", // list of receivers
- // subject: 'Node Contact Request', // Subject line
- // text: req.body.body, // plain text body
- // html: output // html body
- // };
- // // Send your email and handle the error accordingly.
- // transporter.sendMail(mailOptions, (error, info) => {
- // if (error) {
- // return console.log(error);
- // }
- // console.log('Message %s sent: %s', info.messageId, info.response);
- // res.render('contact', {msg:'Email has been sent'});
- // return "Success!"
- // });
- // });
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement