is this likely to also be the problem for my project? Also I have created a new repo with the same files as my original, however I have removed my email and some non-relevant information. GitHub - LawrenceWilliams00/client
I’ve fixed the issue, mb GitHub - LawrenceWilliams00/client. And no worries lol, as long as a solution is found
To make the integration work with a monorepo setup, you will need to add the following to the
netlify.toml in site-b:
[functions.emails] included_files = ["emails/**"]
NETLIFY_EMAILS_DIRECTORY environment variable should then be set to:
I also have a
netlify.toml in the root of my repo that is as follows:
[build] base = "/site-b"
Without these changes, I was getting the exact same issue as report where the email function was hit but the
./emails directory could not be found.
That works I didn’t add the
netlify.toml to the root directory (if I did that, I couldn’t deploy
site-a anymore, right?) but I did set the base directory to
/site-b in the UI which seems to do the trick. Thanks so much for the help.
glad to hear it. Thanks for coming back and sharing your solution.
This fix unfortunately did not work for me. In netlify dev my emails send fine. I added a console log inside the send function that shows that the function is definitely being run, however the email does not actually send. which it does do in dev. There are no error messages at all, and I’m unsure of what else it may be. I have added a copy of my code. I also tried adding “[functions.emails] included_files = “emails/**” and adding base=”/client" to my [build] however it did not resolve the issue.
Hi Lawrence, I pulled down your repo and can confirm I was able to send emails. The only code I had to tweak was your send email function - changing it to send from my domain and to a real email address using my personal sendgrid account and it worked.
Hi, was this a deployed version or a dev version? as for me the dev version will send emails fine, however once I deploy it I am no longer able to send emails at all.
Hi Lawrence, that was both locally and deployed.
Hi, is there anything else that may be causing the issue in my setting or something like that? Using the same code deployed via netlify’s link with github causes the email to not send for me without any errors still
I would suggest using the fetch snippet, rather than the @netlify/emails, to send the emails to see if you can see what errors are being returned. Usually it will be to do with the email provider rejecting the request for a specific reason.
Using the fetch snippit, my code is stating that the message is send, and there are no errors, however now the email does not arrive in my sendgrid via dev or deploy