Getting Started with Vercel
- Create a
formailer.go
in your project at ./api/
:
package api
import (
"net/http"
"github.com/Rubonnek/formailer"
"github.com/Rubonnek/formailer/handlers"
)
// Formailer handles all form submissions
func Formailer(w http.ResponseWriter, r *http.Request) {
contact := formailer.New("Contact")
contact.AddEmail(formailer.Email{
ID: "contact",
To: "info@domain.com",
From: `"Company" <noreply@domain.com>`,
Subject: "New Contact Submission",
})
handlers.Vercel(formailer.DefaultConfig, w, r)
}
- Add your SMTP settings in you Vercel UI.
- Add a hidden input to your form.
<input type="hidden" name="_form_name" value="Contact">