package
0.1.1
Repository: https://github.com/rubonnek/formailer.git
Documentation: pkg.go.dev

# README

Getting Started with Google Cloud Functions

  1. Create a Google Cloud Function 2nd generation.
  2. Create a function.go in your project root:
package gcf

import (
	"net/http"
	"github.com/Rubonnek/formailer"
	"github.com/Rubonnek/formailer/handlers"

	"github.com/GoogleCloudPlatform/functions-framework-go/functions"
)

// Formailer handles all form submissions
func Formailer(w http.ResponseWriter, r *http.Request) {
	contact := formailer.New("Contact")
	contact.AddEmail(formailer.Email{
		ID:      "contact",
		To:      "[email protected]",
		From:    `"Company" <[email protected]>`,
		Subject: "New Contact Submission",
	})

	handlers.Vercel(formailer.DefaultConfig, w, r)
}

// Google Cloud Function entry point defined as "main":
func init() {
	functions.HTTP("main", Formailer)
}
  1. Add your SMTP settings in the Cloud Functions UI.

  2. Add a hidden input to your form.

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