title: Next.JS and Nodemailer, Sending an email from contact form
body: <p>I have a problem with my contact form in next.js, I don't have any errors (that are shown), everything worked untill deployment (on Vercel). I fetch my form, and have status 200, but I do not recive my email on Gmail. Also I don't recive any additional information.
  I've recived emails, when I tested my app on &quot;dev&quot; and &quot;build&quot;.
  I've also have &quot;less secure apps&quot; option in Gmail account.</p>
  <p>Here's my code in Next.JS:</p>
  <p>fetch method in contact.js:</p>
  <pre><code> fetch(&quot;/api/contact&quot;, {
          method: &quot;POST&quot;,
          headers: {
            Accept: &quot;application/json, text/plain, */*&quot;,
            &quot;Content-Type&quot;: &quot;application/json&quot;,
          },
          body: JSON.stringify({
            name: mailName,
            email: mailAddress,
            text: mailText,
          }),
        }).then((res) =&gt; {
          console.log(&quot;Fetch: &quot;, res);
          res.status === 200
          ?
          router.push(&quot;/success&quot;)
            : router.push(&quot;/error&quot;);
  </code></pre>
  <p>in api/contact.js</p>
  <pre><code>require(&quot;dotenv&quot;).config();
  const nodemailer = require(&quot;nodemailer&quot;);
  
  export default (req, res) =&gt; {
  
    const { name, email, text } = req.body;
  
    const transporter = nodemailer.createTransport({
      service: &quot;gmail&quot;,
      auth: {
        user: process.env.EMAIL,
        pass: process.env.PASSWORD,
      },
    });
  
    const mailOption = {
      from: `${email}`,
      to: `${process.env.EMAIL}`,
      subject: `New mail from ${email}`,
      text: `
      ${name} wrote:
      ${text}
      `,
    };
  
    transporter.sendMail(mailOption, (err, data) =&gt; {
      if (err) {
        console.log(err);
      } else {
        console.log(&quot;mail send&quot;);
      }
    });
  
    console.log(name, email, text);
    res.send(&quot;success&quot;);
  };
  </code></pre>
  <p>Please help</p>