Contact Flask

Deploy with Vercel Flask Python

This is a simple email server built with Flask and Flask-Mail. It works fast and seamlessly with your contact form on your static website.

Demo

Check online demo on my website haozhe.li

Quick Start (No coding requires)

  1. Click here to Deploy with Vercel to vercel (it is free and only requires a acount if you haven't had one)

  2. Configure the environment variables as mentioned, also configure your domain (it would be ok if you use the vercel.app ). Here is a quick example for the environment variables:

  3. Create a contact form in your static website. if you already have one, then copy and paste all the id=... and name=... to your own form. Here is an example:

  4. Add the javascript at the buttom of your html file before </body>, remember to change YOUR_DOMAIN to the one you have deployed on vercel.

  5. If you are still confused, check out the demo.html file. Feel free to download it and use it on your own website.

Usage

To use this email server, follow these steps:

  1. Clone the repository:

  2. Install the required dependencies:

  3. Set up the environment variables by creating an .env file in your project directory:

    • MAIL_SERVER: SMTP server address

    • MAIL_USERNAME: SMTP server username.

    • MAIL_PASSWORD: SMTP server password. You may need to generate a secret key or an application-specific password. Don't know how? Check FAQ.

    • MAIL_SENDER: Email address to send emails from

    • MAIL_FORWARD: Email address to forward emails to

    • MAIL_NAME: Name to display in the email

    • VALID_REQUEST_SOURCE: The source of the request, e.g. your website example.com. This will helps you filter the malicious injection. Set to FALSE to disable flitering.

  4. Run the Flask application:

  5. Access the contact form on your static website and start receiving emails!

Deployment

This project is built on flask (python) , so it works on almost all serverless platform. Click here to Deploy with Vercel on vercel, or you can choose any platform that supports flask if you like.

FAQ

A: The most common reason is that your email provider has enforced an app-specific password to protect your account. You will probably need to generate a unique password for this project.

Common Email Provider SMTP articles here:

Your email provider is not listed here? Try searching Your email provider + SMTP on Google, then you will find the solution.

A: This usually happens when you have multiple email addresses under the same account. Please make sure you select your main email address instead of the alias or forwarded address.

Contributing

Contributions are welcome! If you have any suggestions or improvements, please open an issue or submit a pull request.

License

This project is licensed under the MIT License. See the LICENSE file for more information.