hugo-mx-gateway/README.md

88 lines
2.7 KiB
Markdown
Raw Normal View History

2020-05-10 00:02:18 +02:00
# Overview
# Configuration variables
2020-05-14 14:58:22 +02:00
* Create the App Engine configuration file
```
cp app.yaml.sample app.yaml
```
* Edit the `app.yaml` file with your favorite editor and set the following environement variables appropriately:
2020-05-10 00:02:18 +02:00
```
2020-05-14 14:58:22 +02:00
SMTP_SERVER_ADDR: "smtp.mailgun.org:587"
SMTP_VERITY_CERT: true
SMTP_CLIENT_USERNAME: "postmaster@example.com"
SMTP_CLIENT_PASSWORD: "postmasterSecretPassWord"
CONTACT_REPLY_EMAIL: "noreply@example.com"
CONTACT_REPLY_CC_EMAIL: "contact@example.com"
DEMO_URL: "https://demo.example.com/"
ALLOWED_ORIGIN_DOMAIN: "example.com"
2020-05-10 00:02:18 +02:00
```
2020-05-14 14:58:22 +02:00
## Required HTTP Headers
* `Origin`
* `Referer`
2020-05-10 01:20:35 +02:00
## SMTP
https://cloud.google.com/compute/docs/tutorials/sending-mail/using-mailgun?hl=fr
2020-05-14 14:58:22 +02:00
## Test
```
curl -H'Origin: http://realopinsight.com' \
-H'Referer: realopinsight.com' \
-H'Content-Type: application/x-www-form-urlencoded' \
-d 'target=contact' \
-XPOST https://hugo-mx-gateway.ew.r.appspot.com/sendmail
```
2020-05-10 00:02:18 +02:00
# Build
```sh
make build
```
2020-05-14 14:58:22 +02:00
# Hugo Contact Form
See `./model/hugo-contact-form.html`.
```
<div id="reply-message"></div>
<div>
<fieldset>
<legend>Please fill in the form to submit your request</legend>
<form action="https://contact-request-endpoint/" method="post">
<div class="form-item">
<label for="name">Name</label>
<input type="text" name="name" id="name" placeholder="Mr. Smith" />
</div>
<div class="form-item">
<label for="email">Email <span class="req"></span></label>
<input type="text" name="email" id="email" class="required email" placeholder="smith@company.com" />
</div>
<div class="form-item">
<label for="organization">Organization</label>
<input type="text" name="organization" id="organization" placeholder="Company, Inc." />
</div>
{{ if in .Params.tags "contact" }}
<div class="form-item">
<label for="subject">Subject</label>
<input type="text" name="subject" id="subject" value="" placeholder="Need help or expertise?" />
<input type="hidden" name="target" id="target" value="contact" />
</div>
<div class="form-item">
<label for="message">Message</label>
<textarea rows="6" name="message" id="message" placeholder="Please add details concerning your request."></textarea>
</div>
{{ else }}
<div class="form-item">
<input type="hidden" name="subject" id="subject" value="Your Access to Product Demo!" />
<input type="hidden" name="target" id="target" value="demo" />
</div>
{{ end }}
<input class="button" type="submit" value="Submit">
</form>
</fieldset>
</div>
```