form2mail

command module
v0.0.4 Latest Latest
Warning

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

Go to latest
Published: Apr 6, 2022 License: MIT Imports: 6 Imported by: 0

README

form2mail

Build Status Coverage Status GoDevDoc Time Tracker Code lines Comments

This microservice sends emails from a form.

Usage

Create configuration file in .env or set environment variables.

LOG_LEVEL=warn
HTTP_LISTEN_ADDR=127.0.0.1:8008

# Create recaptcha secret keys at https://www.google.com/recaptcha/admin/create.
# Optional, if RECAPTCHA_SECRET_KEY is empty, recaptcha will be disabled.
RECAPTCHA_SECRET_KEY=6Lddl<redacted>
RECAPTCHA_SITE_KEY=6Lddlic<redacted>
RECAPTCHA_V3=true

# SMTP server configuration
SMTP_HOST=smtp.gmail.com
SMTP_PORT=587
SMTP_FROM=myservice@gmail.com
SMTP_PASSWORD=monkey
SMTP_TO=customers@myservice.com

# Optional customizations.
## Subject may be a template, containing placeholders for form fields.
SMTP_SUBJECT=New form received from {{.name}}
## Reply to is the name of the form field that contains the email address.
SMTP_REPLY_TO=email
## Body template files, should contain placeholders for form fields.
SMTP_BODY_HTML_TEMPLATE_FILE=email.template.html
SMTP_BODY_TEMPLATE_FILE=email.template.txt
## Optional path to your langing page contents, it will be served at /*. 
STATIC_DIR=./testpage

Start the service:

form2mail
{"level":"info","@timestamp":"2022-04-02T01:11:45.554+0200","message":"starting server, Swagger UI at http://127.0.0.1:8008/docs"}

Service will serve POST /receive endpoint and will send an email with POST form parameters (including file uploads) and URL query parameters.

Optional success_url and fail_url query/form parameters can be provided to redirect the user.

Documentation

The Go Gopher

There is no documentation for this package.

Directories

Path Synopsis
Package internal protects application packages.
Package internal protects application packages.
domain
Package domain contains domain layer definitions.
Package domain contains domain layer definitions.
infra
Package infra provides application resources and domain implementation.
Package infra provides application resources and domain implementation.
infra/nethttp
Package nethttp manages application http interface.
Package nethttp manages application http interface.
infra/nethttp/ui
Package ui provides application web user interface.
Package ui provides application web user interface.
infra/schema
Package schema provides application-specific schema definitions.
Package schema provides application-specific schema definitions.
infra/service
Package service defines application resources and configuration.
Package service defines application resources and configuration.
usecase
Package usecase provides application use cases.
Package usecase provides application use cases.
Package static provides embedded static assets.
Package static provides embedded static assets.

Jump to

Keyboard shortcuts

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