Getting Started with Netlify
- Create a
main.go
in your project root:
package main
import (
"github.com/aws/aws-lambda-go/lambda"
"github.com/Rubonnek/formailer"
"github.com/Rubonnek/formailer/handlers"
)
func main() {
contact := formailer.New("Contact")
contact.AddEmail(formailer.Email{
ID: "contact",
To: "info@domain.com",
From: `"Company" <noreply@domain.com>`,
Subject: "New Contact Submission",
})
lambda.Start(handlers.Netlify(formailer.DefaultConfig))
}
- Update your
netlify.toml
:
[build]
build="go build -o functions/formailer"
functions="functions"
[build.environment]
GO_IMPORT_PATH="your project git location"
-
Add your SMTP settings in you Netlify UI.
-
Add a hidden input to your form.
<input type="hidden" name="_form_name" value="Contact">