pages
router visit https://github.com/ozcancelik/nextjs-mail-form repository.https://nextjs-14-mail-form-ozcancelik.vercel.app/
.env
file or change the name of .env.example
to .env
and fill the variables.SERVER_PORT=
CONTACT_FORM_SEND_EMAIL=
CONTACT_FORM_RECEIVE_EMAIL=
CONTACT_FORM_PASS=
CONTACT_FORM_HOST=
NEXT_PUBLIC_RECAPTCHA_SITE_KEY=
RECAPTCHA_SECRET_KEY=
npm install
# or
yarn
npm run dev
# or
yarn dev
npm run build
# or
yarn build
npm run start
# or
yarn start
.env
file. If empty, it will use the default port 3000.Tested with Node.js v18.12.1.
Server Actions is a new feature introduced in Next.js 13 that allows you to handle form submissions on the server-side without the need for a separate API route or server.
You can find the server actions in the @/app/actions
file. The sendContactForm
function is used to send the email.