Code Monkey home page Code Monkey logo

http-mailer's Introduction

Description

This is a simple go app that comes with it's own HTTP server that accepts POST requests and sends it of to the provided from e-mail address to the given to e-mail address.

Usage

# ./http-mailer --help
Usage of ./http-mailer:
  -addr string
          Listen address of HTTP server as IP:PORT (default "127.0.0.1:443")
  -auth string
	  SMTP authentication method: CRAMMD5, PLAIN (default "PLAIN")
  -cert string
	  SSL/TLS certificate (x509 pem) (default "./cert.crt")
  -config string
	  Path to ini config for using in go flags. May be relative to the current executable path.
  -configUpdateInterval duration
	  Update interval for re-reading config file set via -config flag. Zero disables config file re-reading.
  -dumpflags
	  Dumps values for all flags defined in the app into stdout in ini-compatible syntax and terminates the app.
  -from string
	  From-Email address
  -key string
	  Private key (default "./cert.key")
  -pw string
	  From-Email account password. If auth is CRAMMD5 pw is used as secret.
  -smtp string
	  Address of the mail server for From-Email as IP:PORT
  -starttls
	  Use STARTTLS for mail transport (default true)
  -tls
	  Use HTTPS for included HTTP-server (default true)
  -to string
	  To-Email address
  -url string
	  URL on which to receive contact form data (default "/contact")
  -user string
	  From-Email account username, if not provided From-Email address will be used instead

Note that by default the HTTP Server uses HTTPS, thus you need to either change the HTTP server listen address or provide a cert and the according private key.

Example

contact-form.html:

<html>
  <body>
    <form action="https://127.0.0.1:8888/contact" method="post">
      First name:<br>
      <input type="text" name="firstname"><br>
      Last name:<br>
      <input type="text" name="lastname"><br>
      E-Mail:<br>
      <input type="email" name="email"><br>
      Message:<br>
      <textarea name="message" rows="4" cols="50"></textarea><br>
      <input type="submit" value="Contact">
    </form>
  </body>
</html>

http-mailer's People

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.