You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Based on what I can see, there doesn't seem to be any documentation on sending emails from an Astro app. The closest thing seems to be the newsletter form on the Actions guide. However, the actual handler used there just ends with a comment //..., so it doesn't go past the actual sending. There isn't a recipe or a guide on Recipes on it as well.
Why this would help / who it's for
Sending a transactional email — contact form, sign-in URL, order confirmation — is a pretty standard use case after you started using Actions or endpoints. Currently, anyone trying to implement something like this has to look outside Astro's documentation and piece everything together from the Nodemailer/provider documentation.
Another related problem is local testing: it's always best practice not to send any emails in the development environment. It's already solved in many other ecosystems (Laravel Sail, Symfony etc. ship a local SMTP "catcher" out of the box), but there's no recommendation for Astro developers how to accomplish the same.
Proposed solution
A recipe page — perhaps recipes/send-email — that demonstrates how to:
Send an email from a server-side Action using Nodemailer (based on the existing newsletter example).
Read SMTP configuration from the environment using astro:env.
Test email locally: instead of using a real provider in your development environment, set your mailer up with a local SMTP catcher (e.g. Mailtrap Local) so that the emails appear in your local inbox UI instead of being sent out.
I'd be happy to open a PR for this if it's something the team would like to have in their documentation. I'm posting this idea here first based on what I've read for how to contribute and because this would be a new content. I'd be also ready to adjust the scope if needed — e.g., make the recipe provider agnostic or mention the local testing only in the Actions guide if that suits the docs structure.
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
Uh oh!
There was an error while loading. Please reload this page.
Based on what I can see, there doesn't seem to be any documentation on sending emails from an Astro app. The closest thing seems to be the newsletter form on the Actions guide. However, the actual handler used there just ends with a comment
//..., so it doesn't go past the actual sending. There isn't a recipe or a guide on Recipes on it as well.Why this would help / who it's for
Sending a transactional email — contact form, sign-in URL, order confirmation — is a pretty standard use case after you started using Actions or endpoints. Currently, anyone trying to implement something like this has to look outside Astro's documentation and piece everything together from the Nodemailer/provider documentation.
Another related problem is local testing: it's always best practice not to send any emails in the development environment. It's already solved in many other ecosystems (Laravel Sail, Symfony etc. ship a local SMTP "catcher" out of the box), but there's no recommendation for Astro developers how to accomplish the same.
Proposed solution
A recipe page — perhaps
recipes/send-email— that demonstrates how to:astro:env.I'd be happy to open a PR for this if it's something the team would like to have in their documentation. I'm posting this idea here first based on what I've read for how to contribute and because this would be a new content. I'd be also ready to adjust the scope if needed — e.g., make the recipe provider agnostic or mention the local testing only in the Actions guide if that suits the docs structure.
All reactions