Server-side PHP code for emailing contact form from GitHub pages or other site. The code is deployed on Heroku and uses SendGrid to send emails.
You should have an account on Heroku. For a small web-site a free acount should be sufficient. If you are new to Heroku read their Getting Started Guide.
Sign up for SendGrid and create an API key.
Clone a repository and create a new Heroku application.
Under application settings define the following Config Vars
:
ALLOWED_ORIGIN <your domain address>
RECIPIENT_EMAIL <your email address>
RECIPIENT_NAME <your name>
SENDGRID_API_KEY <the API key that you created on SendGrid>
See the code in example/contact.html
for a minimum example of a contact form.