- Create an account on https://www.emailjs.com/.
- Link up an email service in https://dashboard.emailjs.com/admin.
- Add an email template in https://dashboard.emailjs.com/admin/templates.
-
Create a
.env.local
file, add yourUser ID
from https://dashboard.emailjs.com/admin/integration,Service ID
from Setup step 2 and theTemplate ID
from Setup step 3 as environment variables. e.g.:.env.local
NEXT_PUBLIC_EMAILJS_KEY=user_XXXXXXXX NEXT_PUBLIC_EMAILJS_SERVICE_ID=demo_service NEXT_PUBLIC_EMAILJS_TEMPLATE_ID=demo_template
Alternatively, paste these values directly into the relevant places in /components/emailjs.js (remember not to commit these values to Git).
Note: if you change these after running the app, you'll need to restart the app for these changes to take effect.
-
Run the development server:
npm install # then npm run dev
-
Open the app at http://localhost:3000.
-
To add/remove fields, modify /components/EmailForm.jsx.