I have a Next js app that have a contact form. I'm using Emailjs to send email to my gmail account. This works perfect in development, but once I deployed it stoped working and it's giving me this message:
Uncaught The user ID is required. Visit https://dashboard.emailjs.com/admin/integration
this is my code (which is basicly the same as the example in the emailjs web)
const [result, setResult] = useState(false);
const form = useRef();
const sendEmail = (e) => {
e.preventDefault();
emailjs
.sendForm(
process.env.EMAIL_SERVICE,
process.env.EMAIL_TEMPLATE,
form.current,
process.env.EMAIL_USER
)
.then(
(result) => {
console.log(result.text);
},
(error) => {
console.log(error.text);
}
);
e.target.reset();
setResult(true);
};
//THIS CODE IS JUST TO ERASE THE "SENT" MESSAGE AFTER 5 secs
setTimeout(() => {
setResult(false);
}, 5000);
I'm using a .env file to have the actual values, and, as I said, works perfectly in development.
Am I missing something to make it work in production?