I believe I have followed the docs to the letter.
I have this in my .env file:
PUBLIC_EMAILJS_USER_ID=Blah1
PUBLIC_EMAILJS_SERVICE_ID=Blah2
PUBLIC_EMAILJS_TEMPLATE_ID=Blah3
I use this code to get the values:
const emailjsUserId = import.meta.env.PUBLIC_EMAILJS_USER_ID; const emailjsServiceId = import.meta.env.PUBLIC_EMAILJS_SERVICE_ID; const emailjsTemplateId = import.meta.env.PUBLIC_EMAILJS_TEMPLATE_ID;
However, the variables are always empty. Thus, this code throws the exception:
if (!emailjsUserId || !emailjsServiceId || !emailjsTemplateId) { throw new Error('EmailJS environment variables are not set in code.'); }
I'm clearly missing something obvious.