FormMaillyGo - Documentation

FormMaillyGo is your serverless contact-form backend. It transforms any static website form into a professionally formatted HTML email, delivered securely via SMTP. Deploy on AWS Lambda for 1M free requests/month, no monthly fees, and full control over your data.

Leverage Gmail’s proven SMTP infrastructure, and eliminate vendor lock-in. Perfect for solo developers, indie hackers, and startups.

1. Prerequisites

2. Enable Gmail 2FA & Create App Password

  1. Go to Google Account → Security.
  2. Under “Signing in to Google,” enable 2-Step Verification.
  3. Now search App passwords from the search bar. (Or click google.com/apppasswords.)
  4. Name it “FormMaillyGo”, then click Create.
  5. Copy the 16-character password (no spaces) and store it securely. You’ll set it as SENDER_EMAIL_PASSWORD in Lambda.

Note: Treat this app password like your main password—do not share it.

3. Build & Package Your Go Lambda

Open your project folder in terminal, compile your Go handler for AWS Lambda’s Linux/ARM64 environment and package it with your frontend:

build.sh
GOOS=linux GOARCH=arm64 CGO_ENABLED=0 \
go build -tags=lambda.norpc -o bootstrap cmd/form_mailly_go/serverless/aws_lambda.go
package.sh
zip -r lambda-handler.zip bootstrap public/

lambda-handler.zip → file will be generated, now upload that file to AWS Lambda.

4. AWS Account Setup

  1. Visit aws.amazon.com and click create account.
  2. Enter email, password, and billing details.

5. Create & Configure Lambda Function

  1. In AWS Console, search Lambda then click on Create function.
  2. Author from scratch:
    • Function name: FormMaillyGo
    • Runtime: Amazon Linux 2023
    • Architecture: arm64
  3. Click Create function.
  4. Under Code → Upload from → .zip file, upload lambda-handler.zip and click Save.
  5. Still in Code, edit Runtime settings → set Handler to main and Save.

6. Configure Environment Variables

Keep secrets out of code—use Lambda environment variables instead.

Navigate to Configuration → Environment variables → Edit → Add environment variable, add each key/value pair, then Save.

7. Expose Your Function via HTTP

7.1 Create a Lambda Function URL

  1. Same Configuration page, go to Function URL.
  2. Click Create function URL.
  3. Auth type: NONE (public). Click Save.
  4. Copy the Function URL (e.g., https://abcd.lambda-url.us-east-1.on.aws/).

This URL directly invokes your Lambda—no API Gateway needed.

8. Test Your Deployment

Open terminal and copy-paste this command, make sure to update the function url.

curl-request.sh

curl -X POST https:// --YOUR-FUNCTION-URL-- /api/contact \
  -H "Content-Type: application/json" \
  -d '{
    "name": "Alice",
    "email": "alice@email.com",
    "subject": "Product Feedback",
    "message": "Loved your product!",
    "product_name": "FormMaillyGo",
    "product_website": "https://ajaynegi45.github.io/FormMaillyGo"
  }'
{ "message": "Email sent successfully" }

If you get this response and an email in your RECEIVER_EMAIL inbox. 🎉

9. Troubleshooting & Tips