recontact

package
v0.0.0-...-3ea0340 Latest Latest
Warning

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

Go to latest
Published: Dec 17, 2023 License: Apache-2.0 Imports: 11 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func BuildHandleContactFormFn

func BuildHandleContactFormFn(sendFn sendFn, confirmFn confirmFn, env AppEnv) func(writer http.ResponseWriter, request *http.Request)

func GetIP

func GetIP(r *http.Request) string

func SendMail

func SendMail(addr, from, subject, body string, to []string) error

ex: SendMail("127.0.0.1:25", (&mail.Address{"from name", "from@example.com"}).String(), "Email Subject", "message body", []string{(&mail.Address{"to name", "to@example.com"}).String()})

Types

type AppEnv

type AppEnv struct {
	PrivateKey string
	ToEmail    string
	AdminEmail string
	EmailHost  string
	EmailPort  string
	AppPort    string
	Endpoint   string
}

func NewAppEnv

func NewAppEnv() AppEnv

NewAppEnv cerates a new env.

type ContactRequest

type ContactRequest struct {
	Recaptcha string `json:"g-recaptcha-response"`
	RemoteIP  string
	Subject   string
	Email     string
	Message   string
}

func NewContactRequest

func NewContactRequest(request *http.Request) (*ContactRequest, error)

Jump to

Keyboard shortcuts

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