{"id":21068948,"url":"https://github.com/cloudprivacylabs/postmail","last_synced_at":"2025-07-20T00:33:55.824Z","repository":{"id":67456378,"uuid":"198754082","full_name":"cloudprivacylabs/postmail","owner":"cloudprivacylabs","description":"Send POST HTML form as email","archived":false,"fork":false,"pushed_at":"2020-01-12T17:54:40.000Z","size":12,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"master","last_synced_at":"2023-04-30T20:32:54.226Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"Go","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/cloudprivacylabs.png","metadata":{"files":{"readme":"readme.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2019-07-25T03:57:03.000Z","updated_at":"2024-06-19T10:26:39.331Z","dependencies_parsed_at":"2023-09-13T03:47:31.355Z","dependency_job_id":null,"html_url":"https://github.com/cloudprivacylabs/postmail","commit_stats":null,"previous_names":[],"tags_count":0,"template":null,"template_full_name":null,"purl":"pkg:github/cloudprivacylabs/postmail","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cloudprivacylabs%2Fpostmail","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cloudprivacylabs%2Fpostmail/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cloudprivacylabs%2Fpostmail/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cloudprivacylabs%2Fpostmail/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/cloudprivacylabs","download_url":"https://codeload.github.com/cloudprivacylabs/postmail/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cloudprivacylabs%2Fpostmail/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":266048695,"owners_count":23868743,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-11-19T18:29:39.209Z","updated_at":"2025-07-20T00:33:55.805Z","avatar_url":"https://github.com/cloudprivacylabs.png","language":"Go","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Simple Form Mailer\n\nSends HTTP form submissions as emails. Useful for contact forms in\nstatic sites.\n\n## Building\n\nJust use:\n\n```\ngo build\n```\n\n## How it works\n\nPostmail works with form configurations. A form configuration has the\nrecipients for the email, its subject, and an optional body\ntemplate. For instance, we have separate forms for \"Contact us\" in the\nweb page, \"Request beta\" for our beta, and a \"Submit feedback\" form\nfor logged in users.  For form configurations are stored in a\nconfiguration file. Each form has a unique ID. In your static website,\nyou can create an HTML form containing any number of fields, with form\nmethod=POST and action that is of the form:\n\n```\n https://\u003cpostmail url\u003e?formId=\u003cid\u003e\u0026ok=\u003credirect url\u003e\u0026err=\u003cerror redirect url\u003e\n```\n\nPostmail loads the form template using formId, builds an email based\non the configuration and sends it. If everything goes fine, it sends a\nredirect to the \"ok\" URL. Otherwise, it sends a redirect to the \"err\"\nURL with a query parameteter \"msg=error message\".\n\n## Form Configuration\n\nAll forms are defined under \"/forms\". The configuration structure is:\n\n```\nforms:\n  id1:\n    \u003cconfig\u003e\n  id2:\n    \u003cconfig\u003e\n```\n\nHere, formId=id1 will select the first form, formId=id2 will select\nthe second, etc.\n\nEach form has these elements:\n\n```\nforms:\n  id1:\n    from: string\n    subject: template\n    recipients:\n    - recipient1 string\n    - recipient 2 string\n    honeypot: string\n    body: template\n    allowCustomRecipient: boolean\n    domain: string\n```\n\n * from: This is going to appear in the \"from\" field of the mail\n   sent. This field is a string (not a template)\n * subject: This is the subject of the email. It is a go template.\n * recipients: This is the fixed set of recipient emails, in the form\n   recipient@domain.com. If the form allows custom recipients, the\n   email is sent to these recipients and the custom ones.\n * honeypot: Name of the honeypot field. If this field is nonempty,\n   mail won't be sent.\n * body: The body template. If empty, the default body template is\n   used that lists all fields with their values.\n * allowCustomRecipients: If this is true, then the form can specify\n   recipient names, and the email will be sent to those people. The\n   form **cannot** specify email domains, only names. The recipients\n   are read from the \"recipient\" form field\n * domain: If custom recipients are allowed, this is their email\n   domain.\n\n\n## Templates\n\nMail body and subject fields are go templates that are evaluated using\nthe following data structure:\n\n```\nform: \u003cHTML form\u003e\nconfig: \u003cform config\u003e\n```\n\nNote that all fields in the HTML form are string arrays. So, if you\nwant to print the subject, you have to do something like:\n\n```\n{{index .form.subject 0}}\n```\n\nwhich will print the first subject submitted.\n\n\nThe default body template is:\n\n```\n{{range $key, $value :=  .form -}}\n{{if eq $key \"ok\" \"err\" \"formId\" \"recipient\" -}}\n{{else -}}\n{{$key}}: {{range $value -}}\n{{.}}\n\n{{end -}}\n{{end -}}\n{{end -}}\n```\n\n## Configuration\n\nYou can specify STMP server and HTTP properties in the command line,\nor in the configuration file:\n\n```\nsmtp-host: localhost\nsmtp-port: 25\n\nhttp-port: 2048\n\ndebug: true\n```\n\nThese are the configuration options:\n\n  * cfg: The configuration file (required) (only command-line)\n  * debug: true or false\n  * smtp-host\n  * smtp-port: default 587\n  * smtp-user\n  * smtp-pwd\n  * smtp-cert: Certificate for SMTP TLS configuration\n  * smtp-key: Certificate key for SMTP TLS configuration\n  * smtp-ca: CA cert for SMTP TLS configuration\n  * http-port: HTTP port, default 80\n  * http-cert: Certificate for TLS configuration\n  * http-key: Certificate key for HTTP TLS configuration\n  * http-ca: CA cert for HTTP TLS configuration\n  \n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcloudprivacylabs%2Fpostmail","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fcloudprivacylabs%2Fpostmail","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcloudprivacylabs%2Fpostmail/lists"}