Next.js: Adding a Nodemailer contact form

Created on 13 Feb 2018  路  2Comments  路  Source: vercel/next.js

I am building a blog with Next.js. I need my contact page to include a contact form so visitors can send emails via Nodemailer.

I am fairly new to Express so I feel in a little over my head. Should I be customizing the Next.js server?

Or should I make a separate server? If so, is that completely separate from my Next.js app?

I currently have pages/contact rendering a form. I am not worried about actually sending the email and all that Nodemailer stuff. I just don't understand where I should be hooking up my configurations.

What would be the recommended way to do implement such a contact form?

Any help greatly appreciated. Thank you!

  • [x ] I have searched the issues of this repository and believe that this is not a duplicate.

Most helpful comment

@jeanmaried I wrote a little piece about doing this: https://medium.com/the-couch/adding-a-contact-form-to-your-next-js-app-7a1b5f63f27

I needed some custom routing so I did the express setup which I talk about, but also if the only thing you need the express service for is the form theres no reason to spin up a microservice for just handling a simple form.

All 2 comments

Or should I make a separate server? If so, is that completely separate from my Next.js app?

This is what we recommend at ZEIT, our frontend (zeit.co) is decoupled from the backend (api.zeit.co).

@jeanmaried I wrote a little piece about doing this: https://medium.com/the-couch/adding-a-contact-form-to-your-next-js-app-7a1b5f63f27

I needed some custom routing so I did the express setup which I talk about, but also if the only thing you need the express service for is the form theres no reason to spin up a microservice for just handling a simple form.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

knipferrc picture knipferrc  路  3Comments

irrigator picture irrigator  路  3Comments

flybayer picture flybayer  路  3Comments

formula349 picture formula349  路  3Comments

rauchg picture rauchg  路  3Comments