A guide to follow once, from top to bottom, the first time you use Gratilaus Form.
It takes you from your site's contact form to a message in your own inbox.
For the commands and how to fix common errors, see QUICK_REFERENCE.md.
Every setting is described in README.md.
0. What you need
An AWS account.
The AWS CLI and the AWS SAM CLI. Install both by AWS's own instructions (the SAM CLI needs Python 3.10 or later).
A profile the AWS CLI can sign in with (made with aws configure, aws login or similar).
Python 3.14. Without it, Docker can do the same job (step 4).
An email address of your own to receive the messages.
Cost: you pay for what you use of API Gateway, Lambda, SES and CloudWatch Logs.
For a contact form this is often small, but check the amounts on each service's pricing page.
The number of requests has a limit (THROTTLE_RATE_LIMIT), which also bounds the cost if the form is abused.
Time: confirming a sender address only takes a click on the link in an email.
Confirming a domain means waiting for DNS to spread.
The commands are written for macOS and Linux. Where Windows differs, it is shown.
1. Go into the folder
Unzip the download and go into its folder in the terminal. Change 1.0.0 to the version number in the zip's name.
On Windows, use python --version for the third line, in a terminal where a Python 3.14 virtual environment is active: deploy.cmd looks for python3.14 or python, not for py.
What success looks like: each prints a version number. The last command prints a line with "Account".
If python3.14 is missing, write SAM_USE_CONTAINER="1" in step 4 (this needs Docker).
3. Prepare the sending of mail (SES)
SES sends only from an address (SES_FROM_EMAIL) that it has "verified".
Prepare it in one of these two ways, in the same Region as AWS_REGION in step 4.
A. Verify an email address (works without a domain of your own)
In the AWS console, open SES and choose Identities → Create identity → Email address.
Enter the sender address and create it. Click the link in the email that arrives at that address (the link expires after 24 hours).
If the receiving address (NOTIFICATION_EMAIL) is another address, verify it the same way.
B. Verify a domain (when you have a domain of your own)
Write the domain in SES_DOMAIN_IDENTITY in step 4, and the deployment sets up the domain's verification.
If the domain's DNS is Route 53, write the hosted zone's ID in SES_DOMAIN_HOSTED_ZONE_ID. The DNS records for the verification are made for you too.
With other DNS, add the three records in the SesDkimRecords output, shown after the deployment, to your DNS yourself.
About the sandbox: in a new account, SES is in the "sandbox" and sends only to verified addresses.
This form sends mail to NOTIFICATION_EMAIL only (never to the visitor).
So once NOTIFICATION_EMAIL is verified, it works in the sandbox.
The sandbox allows 200 messages in 24 hours and 1 a second. For more, request production access in the SES console.
4. Make the settings file
Copy the sample. On Windows: copy deploy.conf.example conf\mysite.conf.
cp deploy.conf.example conf/mysite.conf
Open conf/mysite.conf and change the following. Keep each value in the form KEY="value".
Setting
What to write
AWS_PROFILE
The profile's name from step 2
AWS_REGION
The Region to use (for example us-east-1). The same as in step 3
STACK_NAME
A name for this form: starting with a letter, letters, digits and - only, up to 56 characters (for example mysite-contact)
ALLOWED_ORIGINS
The address of the site the form is on, like https://www.example.org, with no / at the end. Separate several with ,
SITE_NAME
The name put in the mail's subject
NOTIFICATION_EMAIL
The address that receives the messages (one only)
SES_FROM_EMAIL
The sender address (the one verified in step 3)
If you took way B in step 3, also write SES_DOMAIN_IDENTITY and SES_DOMAIN_HOSTED_ZONE_ID.
If python3.14 is missing, write SAM_USE_CONTAINER="1".
For a site in another language, write the eight settings that start with MSG_. They are the sentences visitors see. Left empty, they are in English. The file has a Japanese example of the eight lines, starting at # MSG_SUCCESS="送信しました。…". For a Japanese site, replace the eight empty lines below it, from MSG_SUCCESS="" to MSG_FORBIDDEN="", with the example's eight lines, without the # and the spaces at their start. For another language, write the same eight in that language.
With this, nothing is made in AWS: the settings are checked and the values to be passed are printed.
On Windows (Command Prompt), run set PRINT_PARAMETER_OVERRIDES=1, then .\deploy.cmd --conf conf\mysite.conf.
Afterwards, run set PRINT_PARAMETER_OVERRIDES= to undo it.
In PowerShell, use $env:PRINT_PARAMETER_OVERRIDES="1" instead, and Remove-Item Env:PRINT_PARAMETER_OVERRIDES to undo it (set does not set it there, and the real deployment would run).
What success looks like: lines of Name="value", like AllowedOrigins="https://…", and no [ERROR].
After an [ERROR], the next line says how to fix it. See also "Common errors" in QUICK_REFERENCE.md.
6. Deploy
./deploy.sh --conf conf/mysite.conf
On Windows: .\deploy.cmd --conf conf\mysite.conf.
What success looks like: near the end, a line Endpoint: with a https://…/contact URL under it.
That URL is where the form sends to.
If you took way B in step 3, sending fails until the domain is "verified".
The deployment ends by showing a command to check that.
7. Connect the page
A site made with Gratilaus Site: write the URL from step 6 in mailform.endpoint in config/site.yaml, and build the site again. The contact page (content/contact) then sends to that URL.
A page of your own: copy the part of examples/contact.html (in Japanese: examples/contact.ja.html) between the markers (copy from here, copy to here) into your page.
Replace data-endpoint="MAILFORM_ENDPOINT_URL" with the URL from step 6.
Put frontend/mailform.js near your pages, and point <script src> at it.
The sentences on the screen can be changed with the attributes that start with data-msg-.
8. Send one test message
Send one message from the form on your site.
What success looks like: the screen shows the sent message (MSG_SUCCESS), and the mail arrives at NOTIFICATION_EMAIL.
Its subject carries SITE_NAME. A reply goes to the visitor's address.
The mail ends with the sender's IP address and browser. Say so in your privacy policy, or use the definition that leaves them out (examples/forms.contact-without-ip.json; see "Form definitions" in README.md).
If nothing arrives, or the screen shows an error, see "When mail does not arrive" in QUICK_REFERENCE.md.
When the second line ends without printing anything, the deletion is done. These are left behind; delete them yourself if you do not need them.
The domain verification made in step 3, way B, and its three Route 53 records (kept on purpose, so they are not lost by mistake).
An S3 bucket named sam-artifacts-<account ID>-<Region> (where the deployment's files are kept).
A log group whose name starts with API-Gateway-Execution-Logs_.
If this stack made API Gateway's logging role, deleting the stack deletes that role too.
That stops the logs of other APIs in the same Region as well, so first read "About the account-level API Gateway setting" in README.md.
About the license: every page with the form, and every page that loads mailform.js, shows a one-line credit. The line under the form in examples/contact.html is an example.
On a site made with Gratilaus Site, the footer's credit is enough. The details are in "License" in README.md.
A sheet to look things up in, from the second time on. The first time, start with QUICKSTART.md.
Every setting is described in README.md.
Commands
Run them in this folder. Replace each <…> with your own value.
On Windows, read ./deploy.sh as .\deploy.cmd, and / as \ in the paths of files (conf/mysite.conf), not in AWS names such as the log group.
In the Windows Command Prompt, for the first line run set PRINT_PARAMETER_OVERRIDES=1, then .\deploy.cmd --conf conf\mysite.conf, and finally set PRINT_PARAMETER_OVERRIDES= to undo it. In PowerShell, use $env:PRINT_PARAMETER_OVERRIDES="1" and Remove-Item Env:PRINT_PARAMETER_OVERRIDES.
Every command ends with exit code 0 when it succeeds, --check-forms and PRINT_PARAMETER_OVERRIDES=1 included. deploy.sh and deploy.cmd end with 1 when they refuse a setting or a form definition (with a message, usually starting with [ERROR]), and otherwise with the exit code of the AWS CLI or AWS SAM CLI command that failed. Each test in tests/ ends with 0 when every check passes and with 1 otherwise.
The settings file
Make it by copying deploy.conf.example to conf/<name>.conf. Write each value as KEY="value".
Setting
What it is
Needed?
AWS_PROFILE, AWS_REGION
The profile to sign in with, and the Region
Yes
STACK_NAME
A name for this form (starting with a letter; letters, digits and -; up to 56 characters)
Yes
ALLOWED_ORIGINS
The address of the site the form is on (like https://www.example.org; separate several with ,)
Yes
SITE_NAME
The name put in the mail's subject (website when not set)
No
NOTIFICATION_EMAIL
The address that receives the messages (one only)
Yes
SES_FROM_EMAIL
The sender address (verified in SES)
Yes
SES_REGION
Only when SES is used in another Region
No
SES_DOMAIN_IDENTITY, SES_DOMAIN_HOSTED_ZONE_ID
When the deployment should set up the domain's verification
No
MSG_SUCCESS and the other MSG_ settings (eight in all)
The sentences visitors see. Empty means English. If you write them, write all eight
Yes, for a site in another language
FORMS_FILE
A form definition (JSON) with fields of your own. The path counts from the settings file's folder
No
THROTTLE_RATE_LIMIT, THROTTLE_BURST_LIMIT
The most requests accepted per second
No
SAM_USE_CONTAINER
"1" when Python 3.14 is missing (needs Docker)
No
Where the sentences on the screen come from
Where
What it changes
The eight data-msg- attributes in the page's HTML (intro, no-endpoint, need-agree, confirm, sending, cancelled, bad-response, failed)
Sentences decided in the browser (sending, the confirmation, a failed connection, and so on)
<label> and the like in the page's HTML
The fields' names
The eight MSG_ settings in the settings file
Sentences the server answers with after a send (sent, a mistake in the input, and so on)
messages in the FORMS_FILE definition
The server's sentences when a definition is used (then only MSG_INVALID, MSG_FAILED and MSG_FORBIDDEN are read)
To send without the confirmation dialog, add data-confirm="off" to #mailform-root.
Your files and the product's files
To move to a new version, you keep your files and take the product's from the new version. If you edit a product file, you have to redo the edit at every new version, so change the fields and the sentences with a form definition and the MSG_ settings.
Kind
Files
Yours (a new version does not replace them)
Your settings files (conf/<name>.conf, made from deploy.conf.example), your form definitions (FORMS_FILE, such as conf/forms.json), and the pages of your site that carry the form
The product's (replaced when you move to a new version)
lambda/, template.yaml, deploy.py, deploy.sh and deploy.cmd, deploy.conf.example, frontend/mailform.js, examples/, tests/, requirements.txt, LICENSE and NOTICE, AGENTS.md and the documents such as the README, .github/
.aws-sam/ is made again by every deployment; do not copy it to the new version. A copy of mailform.js on your site is replaced only when the CHANGELOG says it changed. The steps are in "Upgrading to a new version" in README.md.
When mail does not arrive
What the screen shows
Likely cause
What to do
That the form has no endpoint (data-msg-no-endpoint)
The page has no URL to send to
With Gratilaus Site, write mailform.endpoint and build again. On a page of your own, write data-endpoint
That sending failed (data-msg-failed)
The page's address is not in ALLOWED_ORIGINS (with and without www, and http and https, are different addresses), or the URL is wrong
Fix ALLOWED_ORIGINS and deploy again. The browser's developer tools show a detailed error starting with mailform: in the console
A sentence about the input (MSG_INVALID and others)
The input did not pass the checks
Correct the input as the sentence says. After changing the fields, compare the definition with the page with --check-forms --html
The sentence for a failed send (MSG_FAILED)
SES could not send (the sender or the receiver is not verified, or the Region differs), or there were too many requests
Read the log. A line with SES send_email failed gives the reason
The sentence for an unexpected answer (data-msg-bad-response)
The URL points at something else
Use the …/contact URL the deployment printed
The sent sentence appears, but no mail arrives
The mail went to the spam folder
Look in the spam folder, and mark the mail as not spam at the receiving end
The same mail arrives twice
The answer to the send had no Access-Control-Allow-Origin, so the visitor sent again
Check with the two curl commands in "After deploying, check this" in README.md
Common errors (deploy.sh)
Message
Fix
[ERROR] configuration file not found
Check the path after --conf. A list of the settings files you can use follows
[ERROR] NOTIFICATION_EMAIL still has the sample value
Write your own address instead of the sample (the same for SES_FROM_EMAIL)
[ERROR] ALLOWED_ORIGINS still has the sample origins
Write your own site's address
[ERROR] not in the form a browser sends as Origin
Write it like https://www.example.org: lower case, with no / at the end and no path
[ERROR] … MSG_* value(s) set and … empty
Write all eight MSG_ settings, or leave all eight empty
[ERROR] … is not an email address
Correct the address
[ERROR] … takes one address
Write one address. To reach several people, use forwarding at the receiving end
[ERROR] STACK_NAME starts with a letter and has only letters, digits and -
Start with a letter, and use only letters, digits and - (no _)
[ERROR] … $ and ` are not supported
Remove the $ and ` from the value, or put the value in '...'
[ERROR] FORMS_FILE not found
Look at the path shown. The path counts from the settings file's folder (from a settings file in conf/, write forms.json for conf/forms.json)
[ERROR] Python 3.14 not found
Install Python 3.14, or set SAM_USE_CONTAINER="1" (needs Docker)
[ERROR] aws not found / [ERROR] sam not found
Install the AWS CLI or the AWS SAM CLI
Working with an AI coding agent
AGENTS.md in this folder gives AI coding agents (Codex, GitHub Copilot, Cursor, Claude Code and others) the rules for this project: which files to change, the license's credit, and what to leave to you.
Claude Code (v2.1.277 or later) reads AGENTS.md on its own only when there is no CLAUDE.md, .claude/CLAUDE.md or CLAUDE.local.md in this folder or a folder above it. If you keep one, put the line @AGENTS.md at the top of your CLAUDE.md.
Gemini CLI reads GEMINI.md by default. Add "AGENTS.md" to context.fileName in its settings.json.
The license's credit
You may use, modify and redistribute it, including for commercial use, on the same terms as Apache-2.0 (the patent grant too). However, on top of the Apache-2.0 terms, every page with the form, and every page that loads mailform.js, must visibly show the line below (H.K. a link to https://hidekazu-konishi.com/) (Section 4A).
It is not added for you; add it yourself, usually under the form (the line under the form in examples/contact.html).
<p class="mailform-credit">Gratilaus Form by <a href="https://hidekazu-konishi.com/" rel="nofollow">H.K.</a></p>
Visible means: on every screen size and color scheme, without a click or hover. Do not hide it with your CSS or scripts, do not make it smaller than the smallest other text in the same area, and keep a contrast of at least 4.5:1 against its background. The link has to take a visitor to https://hidekazu-konishi.com/.
A site made with Gratilaus Site shows Built with Gratilaus by H.K. in its footer, so it does not need this line.
The rules for rewording or translating it (it may not suggest that the author endorses the site), and what can stand in for the credit (the exemption), are in "License" in README.md.
Terms
Term
Meaning
Stack
The set of AWS parts made for this form (named by STACK_NAME). It is deleted as a whole too
Profile
The name of the sign-in the AWS CLI uses (AWS_PROFILE)
Region
An AWS location (us-east-1 is N. Virginia). Usually SES and the form are in the same Region; if not, set SES_REGION
SES
AWS's mail sending service (Amazon Simple Email Service)
Verified (SES)
SES has confirmed that the owner of the address (or domain) uses it. The sender must be verified
Sandbox (SES)
The restricted state of SES in a new account: it sends only to verified addresses
Endpoint
The URL the form sends to (the …/contact the deployment prints)
Origin
The https://host part of a page's address. Only the ones in ALLOWED_ORIGINS are accepted
Preflight
The request (OPTIONS) a browser makes before sending, to ask whether it may
Honeypot
A field people cannot see, a trap that tells automated sends apart
Credit
The one line Gratilaus Form by H.K. on the pages with the form, a condition of the license