Building a contact form that actually works in production can feel a bit like wrestling with invisible gremlins. My latest project—a Next.js site deployed on Vercel—started off simply: hook up Nodemailer to Gmail’s SMTP, let visitors drop me a line, and call it a day. But Google’s recent security updates meant “less secure” username/password logins were a dead end. I spent an afternoon learning OAuth2, generating a refresh token in the Google OAuth Playground, and wiring up the googleapis client so my serverless function could grab fresh access tokens on demand. It was a satisfying win—until I noticed every message I sent to myself arrived already marked as “read.” Cue a deep dive into Gmail’s threading quirks and the realization that “you→you” emails are auto-marked read unless they come from a verified alias or a separate relay.
Once I figured out why my test messages were disappearing into the abyss of my Sent mail, I refocused on what really matters: making the form safe and user-friendly. I added simple but essential validation—no blank names, properly formatted emails, and messages between 10 and 500 characters—so I wouldn’t get spammy or accidentally huge payloads. The solution now feels solid: real people can reach me without bots hammering my inbox, and the email plumbing is bulletproof against Google’s ever-tightening security. All in all, it was a lesson in patience, digging into documentation, and knowing that a seemingly small “Hello world” feature can quickly teach you about the underbelly of modern web platforms.