This is a very simple project to do the following:
-
Receive a POST from an HTML form - expected parameters are
from_namefrom_emailtitlebody
And the
Content-Typeshould beapplication/x-www-form-urlencoded. -
Convert that POST into an email to a pre-defined email address, via Mailgun's API
-
Redirect to a predefined URL with the parameters
statusandmessage(if status iserror)
That's it - it's very simple
cargo build --releasebrew install filosottile/musl-cross/musl-cross
CC_x86_64_unknown_linux_musl="x86_64-linux-musl-gcc" cargo build --release --target=x86_64-unknown-linux-muslsudo apt-get install musl-tools
CC_x86_64_unknown_linux_musl="musl-gcc" cargo build --release --target=x86_64-unknown-linux-muslMAILGUN_API_KEY="<insert api key>" \
MAILGUN_DOMAIN="<insert mailgun domain>" \
MAILGUN_TO_ADDRESS="<insert address to send posted data to>" \
MAILGUN_REDIRECT_URL="<HTTP address to redirect with 303 to after processing POST>" \
./target/release/mailgun-contact-formRUST_LOG: Control the logging level. Set toactix_web=info,mailgun_contact_form=infoto get basic logging for the web framework and the applicationBIND_ADDRESS: The address to bind to. Defaults to0.0.0.0PORT: The port to bind to. Defaults to8088