Emailjs no location defined
Unanswered
Rex posted this in #help-forum
RexOP
After sending an email:
ReferenceError: location is not defined
ReferenceError: location is not defined
5 Replies
@Rex After sending an email:
ReferenceError: location is not defined
could you show some code
@Ray could you show some code
RexOP
I discovered that when you try to send en email from a server side page, it gives you this error.
It only works in client-side for me.
So the code that I put inside the page is like this:
It only works in client-side for me.
So the code that I put inside the page is like this:
emailjs.
send(
serviceID,
templateID,
params:{},
publicKEY).
then((result) => console.log(result.text); )Since its a client side component, thats the reason you are getting the error
@Rex I discovered that when you try to send en email from a server side page, it gives you this error.
It only works in client-side for me.
So the code that I put inside the page is like this:
javascript
emailjs.
send(
serviceID,
templateID,
params:{},
publicKEY).
then((result) => console.log(result.text); )
never used emailjs so I'm not sure but the error should be caused by trying to use browser location api on the server
@Rex I discovered that when you try to send en email from a server side page, it gives you this error.
It only works in client-side for me.
So the code that I put inside the page is like this:
javascript
emailjs.
send(
serviceID,
templateID,
params:{},
publicKEY).
then((result) => console.log(result.text); )
are you using
@emailjs/browser? try @emailjs/nodejs instead