/email-generator

https://generator.aydenjahola.com

Primary LanguageHTMLGNU Affero General Public License v3.0AGPL-3.0

Newsletter Generator

This Python script generates newsletters for the DCU Esports community. It uses a Jinja2 template to create customized newsletters with dynamic content.

Table of Contents

Getting Started

Follow the instructions below to get started with the DCU Esports Newsletter Generator.

Prerequisites

  • Python 3.x
  • Jinja2 (Python template engine)
  • Flask (for the web GUI)

You can install the requirements using pip:

pip install -r requirements.txt

Usage

Manual Generation (auto_generate.py)

If you prefer the manual way of generating newsletters, follow these steps:

Note: Not all features are available in the manual generation method. Use the web GUI for the full experience.

  1. Clone the repository
git clone git@github.com:aydenjahola/email-generator.git
  1. Navigate to the project directory
cd email-generator
  1. Prepare your newsletter content by modifying the script. You can update the topic_data, tldr_data, and other dynamic content as needed.
  2. Create your newsletter template in HTML format. The template should include placeholders (using double curly braces) for dynamic content, which the script will replace.
  3. Save the newsletter template in the templates directory.
  4. Update the script with the appropriate file paths and dynamic content.
  5. Run the script
python3 auto_generator.py
  1. The script will generate the newsletter, create an output directory based on the week_number, and save the newsletter in that directory.
  2. You can find the generated newsletters in the outputs directory. Each newsletter is saved in a subdirectory named after the week number.

Web GUI (app.py)

If you prefer a web GUI to generate newsletters, follow these steps:

  1. Clone the repository
git clone git@github.com:aydenjahola/email-generator.git
  1. Navigate to the project directory
cd email-generator
  1. you can create your template in the templates directory. The template should include placeholders (using double curly braces) for dynamic content, which the script will replace.
  2. Run the script
flask run --debug
  1. Access the web GUI by opening a web browser and going to http://localhost:5000.
  2. Fill out the form with the appropriate information and click Generate Newsletter.
  3. The script will generate the newsletter, create an output directory based on the week_number, and save the newsletter in that directory.
  4. You can find the generated newsletters in the outputs directory. Each newsletter is saved in a subdirectory named after the week number.

Deploy on docker

to deploy on docker you can use the script deploy.sh to build and run the container

./deploy.sh

Directory Structure

.
├── auto_generator.py
├── app.py
├── outputs
│   ├── week_1
│   │   └── week_1_newsletter.html
│   ├── week_2
│   │   └── week_2_newsletter.html
│   ├── week_3
│   │   └── week_3_newsletter.html
│   ├── week_4
│   │   └── week_4_newsletter.html
│   ├── week_5
│   │   └── week_5_newsletter.html
├── templates
│   └── newsletter_template.html
├── pages
│   ├── index.html
│   ├── success.html
│   ├── error.html
└── README.md

TODO

  • production server
  • add more dynamic content
  • add more newsletter templates
  • add more newsletter examples
  • add more documentation
  • optimize the app more
  • add more error handling
  • add tests
  • add copy button

License

This project is licensed under the AGPLv3 License - see the LICENSE file for details.