Skip to content
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

Fix contact form #738

Merged
merged 2 commits into from
May 17, 2024
Merged

Fix contact form #738

merged 2 commits into from
May 17, 2024

Conversation

danielstreif
Copy link
Collaborator

@danielstreif danielstreif commented May 15, 2024

The contact form has not been working since we moved to DigitalOcean because by default SMTP port 25 is blocked. This should prevent the use of DigitalOcean domains to send out spam emails (see https://docs.digitalocean.com/support/why-is-smtp-blocked/).

The suggested workaround is to use SendGrid. I've created an account with our dev address there and followed these docs to set everything up.

I've already changed the env vars so this should work once the PR is merged. Let me know if there are any questions.

SendGrid requires fromto be identical with the verified email address, so an additional replyTo field is necessary to actually reply to the person who sent the contact request via the form on the website.

@pheeria
Copy link
Member

pheeria commented May 15, 2024

Hi 🖖

Great to see you found an answer 🚀

A couple of remarks:

  • Does it mean that Digital Ocean was blocking port 25 outgoing traffic? We didn't host a mail server 😅
  • I assume that some of your code wasn't yet pushed, since sendgrid requires a new library instead of nodemailer, according to the docs you mentioned.

@danielstreif
Copy link
Collaborator Author

danielstreif commented May 15, 2024

Hi Olzhas, thanks for the quick response! I guess I didn't draw the right conclusion then with the port 25 issue. I thought we are using the DigitalOcean domain as a mail server since we have the MX values set there. Not on my machine at the moment but I can look into it later on.

That aside, using SendGrid did fix our issue. I posted the wrong docs link though (multiple tabs open), sorry for that. I actually followed these instructions, no additional library required.

https://www.twilio.com/en-us/blog/send-smtp-emails-node-js-sendgrid

Locally everything works fine and I can use the contact form.

Edit: I am aware we aren't using DigitalOcean as a mail server but we are routing through it, right?

@danielstreif
Copy link
Collaborator Author

danielstreif commented May 17, 2024

@pheeria a bit more information how I got to the current state of this PR:

The error we get when trying to send an email is 535, so an authentication issue. The credentials are definitely correct, so it might be a configuration/security settings related problem. I first checked our email provider but couldn't find anything there. Port etc. were set correctly.

As we are routing the emails through DigitalOcean I followed their suggestion to use SendGrid and it worked. Do we want to go with this solution or find another way?

@pheeria
Copy link
Member

pheeria commented May 17, 2024

If this works, then let's go with it!
We don't run our own mail server, it's still on United Domains, however the domain is managed by Digital Ocean, hence you see port numbers in domain configs.

@danielstreif danielstreif merged commit 8329ab4 into master May 17, 2024
1 check passed
@danielstreif danielstreif deleted the fix-contact-form branch May 17, 2024 17:54
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants