Skip to content
/ cosgo Public

📝 Experimental (broken?) Contact Form Server. Saves to local .mbox file... Option for GPG, SendGrid. Easy Heroku deployment.

License

Notifications You must be signed in to change notification settings

aerth/cosgo

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

67 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Contact API Server in Golang

Copyright (c) 2016 aerth

Installation / Updating

go get -v -u github.com/aerth/casgo

Usage

export MANDRILL_KEY=123456789
export [email protected]
casgo -debug

or

export MANDRILL_KEY=123456789
export CASGO_API_KEY=contact # for easy /contact/form
export [email protected]
nohup casgo -fastcgi -insecure -port 6060 &
< press Ctrl+C >
tail -f debug.log

casgo looks for this template in ./templates/form.html

{{define "Contact"}}
<!DOCTYPE html>
<html>
<body>
<form id="contact-form" action="/{{.Key}}/send" method="POST">
    <input type="text" name="email" placeholder="email" required/><br/>
    <input type="text" name="subject" placeholder="subject"/><br/>
    <input type="text" name="message" placeholder="message" required/><br/>
    {{ .csrfField }}
    <input id="contact-submit" type="submit" value="Say hello!" />
</form>
</body>
</html>
{{end}}




Sample Nginx Config

server {
        server_name default_address;
        listen 80;

        location / {

        proxy_pass http:https://127.0.0.1:6098; # Change to your static site's port

        }
        location /contact/form/send {
        proxy_pass http:https://127.0.0.1:6099; # Change using "casgo -port XXX"
        }
}

Repeat for each virtual host. nginx server block coming soon.

Future

  • Option to use different mail handler (not only mandrill)

  • .config File

  • templates/ folder

  • Pull requests from strangers are cool!

Historical Information

About

📝 Experimental (broken?) Contact Form Server. Saves to local .mbox file... Option for GPG, SendGrid. Easy Heroku deployment.

Topics

Resources

License

Stars

Watchers

Forks

Packages