Skip to content

Conversation

@DSCmatter
Copy link

@DSCmatter DSCmatter commented Dec 13, 2025

Contact Form Request Forwarding with Spam Protection

This PR Fixes #148

Summary

Implements backend email forwarding for the contact form with basic spam protection and input validation.

Changes

  • Added pages/api/contact.ts to handle contact form submissions
    • Validates required fields (name, email, text) and email format
    • Implements a honeypot field (confirm_email) to silently ignore bot submissions
    • Forwards valid requests to team@ergoplatform.org using nodemailer
  • Updated components/shared/ContributeForm.tsx
    • Added invisible honeypot field
    • Updated submission flow to use /api/contact API route

Verification

  • Honeypot filled → 200 OK, no email sent
  • Valid request → 200 OK, email send attempted (blocked locally due to mock SMTP)
  • Missing fields → 400 Bad Request

Notes

Email delivery requires valid SMTP credentials. Configure the following environment variables:
SMTP_HOST, SMTP_PORT, SMTP_USER, SMTP_PASS, SMTP_SECURE, SMTP_FROM
Example is given .env.example in the project's root

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.

Contact Requests should forward to team@ergoplatform.org

1 participant