'Where do I get user and pass for email form api setup?
I am trying to get this form working in Nextjs using 'React Hook Form'. So far I think everything is okay, but I need to know where to get the 'user' and 'pass' for the API to send the information in the form.
It is probably a stupid question but when learning how to get forms to work, all tutorials just explain how to console log the information to display it as an alert, which is not very helpful when trying to do it properly and get it working.
Hope someone can help me out, thanks
import nodemailer from 'nodemailer'
export default async (req, res) => {
const {name, surname, companyName, email, numberOfEmployees, message, consentimiento } = req.body;
const transporter = nodemailer.createTransport({
host: 'smtp.gmail.com',
port: 465,
secure: true,
auth: {
user: process.env.user,
pass: process.env.pass
}
})
Solution 1:[1]
Looks like you're using Gmail as your mailing service?
To get this working you'll probably need to set up an app password with your gmail account - https://support.google.com/mail/answer/185833?hl=en
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
Solution | Source |
---|---|
Solution 1 | John Detlefs |