Hi. I need some help. I have read the documentation here about sending emails through sendgrid. I have also watched a few tutorials. My form is working, sending inputs to the database. But it’s not sending the email when I hit submit. Thanks in advance.
Hi,
If you haven’t already watched this specific tutorial, I recommend it: - YouTube
Otherwise, please send us the url of your site, so we may further check.
Thanks,
Itay Koren
Hello. Yes I did watch that and copied exactly the code. I watched a few others and tried different code - it just doesn’t fire the email. The inputs are getting captured in the database. The site is www.hvarchef.com — I am going to go back in and change the code back to the original now. Thank you!!
Hi,
From what I see, it’s because you have 2 data sets - The form is connected to one of them, and the ‘onAfterSave’ hook is connected to the other.
If you connect both to the same data set (I would suggest to also remove one of them if you don’t need both), it should work.
Itay
Thank you so much. I didn’t see that other dataset, it was added in error. I went back and connected everything to the dataset2. But I am getting an error that the recipient isn’t defined when I try to submit. I imagine that has to do with the hook you mentioned. Can you advise. Thanks for your patience I am new at this. - Stacey
I tested the onaftersave in the page code and it seems to be working, but still no email is sent. I defined the recipient again and don’t get an error. Any further ideas? Thanks so much.
Hi,
Yes, in ‘booking information’ page I would comment out the part you don’t need (either calling ‘sendEmailWithRecipient’ or calling ‘sendEmail’ , no need to call both).
Also, add ‘return’ before calling it.
I tested on a site cloned from yours and it worked (I got an email, though it went to my spam folder).
Example:
return sendEmailWithRecipient(subject, body,recipient)
.then(response => console.log(response));
// sendEmail(subject, body)
// .then(response => console.log(response));
Let me know how it goes.
Itay
Thanks so much for all of your help!!
No problem, glad I could help.