netlify

command
v0.5.4 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Oct 18, 2022 License: MPL-2.0 Imports: 3 Imported by: 0

README

Getting Started with Netlify

  1. Create a main.go in your project root:
package main

import (
	"github.com/aws/aws-lambda-go/lambda"
	"github.com/djatwood/formailer"
	"github.com/djatwood/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))
}
  1. Update your netlify.toml:
[build]
    build="go build -o functions/formailer"
    functions="functions" 
[build.environment]
    GO_IMPORT_PATH="your project git location"
  1. Add your SMTP settings in you Netlify UI.

  2. Add a hidden input to your form.

<input type="hidden" name="_form_name" value="Contact">

Documentation

The Go Gopher

There is no documentation for this package.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL