-
Notifications
You must be signed in to change notification settings - Fork 15
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Question: Can our contact forms trigger an immediate email? #245
Comments
Hey :D This is indeed possible. What email provider is sales@wgtwo using? I need to see if the email provider (Gmail, Outlook, etc.) has an API for sending emails on behalf of an email account, or if this requires extra code to be written server-side. :) |
Hi @Prid13 We use Gmail / Google email as our provider. @jonny-wg2 - perhaps you have some insight here? |
Perhaps leveraging sendgrid API we could do this? If we need to do something wervside netlify functions would be a good option - as we are hosting the dev website with them today. |
Did you get a chance to look further into this one, @Prid13 ? |
Wanted to research this thorougly, but have been a bit busy so haven't had the chance yet. But will do it as soon as I get the chance :) |
Great, let us know when you might have a chance to look at it! |
Sorry it's taking so long :( Will have my proposed solution posted within the day 😇 Thanks for the patience ⭐ |
Ok, no problem! |
After doing proper research, I've come to the conclusion that we can leverage Gmail's SMTP mail servers to send an email on behalf of a Gmail account. This will require some backend code to be run, which, as @jonny-wg2 so thoughfully suggested, can be run via Netlify Functions. Here's the excellent tutorial I found: https://www.labnol.org/gmail-smtp-send-emails-220530 We'll need to create a new "Google Cloud Project", which will essentially be used to get some valid API and authentication tokens that can be used to send those emails, and then write some simple Node.js backend code to deliver those emails :) I'll need access to the Gmail account to set up the "Cloud Project" system and get those tokens, and I'm also going to need access to Netlify for deploying the serverless backend code :) I think the only "restriction" is that up to 100 mails can be sent a day, but I gather that won't be a problem for quite a while 😅 |
Hey @Prid13 recently WG2 has moved to leverage sendgrid for sending all emails for applications and am hesitant to setup this via google API. A couple cons are, we might need to create a dedicated google user for sending these emails? And second - this isn't used by any other projects today. Looking at sendgrid and netlify - what are your thoughts on this tutorial? https://slawinski.dev/blog/start-sending-emails-using-netlify-lambda-functions-and-sendgrid/ Note, we will need to also think about abuse here and come up with a solution to limit bots from sending a bunch of emails from our email. Perhaps recaptcha would be a reasonable solution https://www.npmjs.com/package/react-google-recaptcha-v3 |
Oh, cool, didn't know about that 😅 Then we should definitely go with SendGrid :) That tutorial looks like a good starting point for getting this off the ground ⭐ About the abuse part, is wgtwo getting any sizeable amount of traffic from bots -- is there any data on this? Taking precautions is always a plus, but personally speaking, a captcha solution would only get in the way and add more friction to the form filling out process for the end user, so perhaps a "less secure" way could be implemented for now that doesn't bother the user, or? I was thinking perhaps checking for the IP address in Netlify Functions and terminating the code execution if the same IP is used multiple times in a short period of time. What do you think? Is this necessary at this stage? :) |
+2 on the captcha and friction. Ok let's hold off on this for now. We see probably 1 spam message a week. The regex filtering that you added before really helped cut down the spam. It might be difficult to to check IP as we won't have a storage with the netlify functions. Checking now though - I see netlify functions cost money... $20 a month. I see that cloudflare works are however free.. Here is a good tutorial here on how to use this with sendgrid and cloudflare workers https://blog.amanbhargava.com/send-email-using-cloudflare-worker @torotimes note about ^ If we do this, we probably also need to build out a template in sendgrid on what to send as part of the email. |
Thanks for helping me discover Cloudflare Workers -- what a steal! Never knew they offered such a great, gratis service -- as if they weren't generous already 😇 But are we looking at the same page for the Netlify Functions pricing? Pro tier costs $20/mo, but the Functions page does state the Free tier including 125,000 free requests per month: 🤔 |
Ahh perfect, I was dupped by netlify's pricing page and the "background functions" offering. But ok then sweet, let's go forward with netlify as this integrates nicely with our existing dev setup. @Prid13 I sent you an email with some extra details on getting started for testing. |
Hi @Prid13 did you have a closer look at this? |
Hi @Prid13 what's the status on this one? |
Sorry @torotimes, jonny sent me some keys before his trip and the total mess of an organizer I am I completely forgot to fetch those keys before they "expired". So this is on hold till he returns 😅 sorry :/ |
@jonny-wg2 Hey, I need a little help with this :) Have uploaded a Here's the folder in the branch: https://github.com/working-group-two/wgtwo.com/tree/dev-pages/netlify/functions/sendmail What am I doing wrong? Thanks 😇 |
Hey! Just checked netlify and looks like a build error
|
Finally done: #400 I am deeply sorry that this took so long. Truly appreciate the patience ⭐ |
Hey @Prid13
Question for ya:
Today our contact forms (like https://www.wgtwo.com/contact/ ) trigger a slack notification on our end. That's nice and works fine.
What I'm wondering is whether it could ALSO trigger an automatic email response to the person who submitted the form?
We could use something like "[email protected]" as sender, with a message that thanks for them for getting in touch and say a few words about what will happen next. I can write that email, but wanted to find out if we can make the process work first.
The text was updated successfully, but these errors were encountered: