import os
from flask import Flask, request, render_template, redirect, url_for, session
from flask_bootstrap import Bootstrap
import smtplib
from email.mime.text import MIMEText
from email.mime.multipart import MIMEMultipart
from abilities import llm_prompt

app = Flask(__name__)
app.config['SECRET_KEY'] = 'a_very_secret_key'


@app.route('/', methods=['GET', 'POST'])
def index():
    if request.method == 'POST':
        user_prompt = request.form['prompt']
        recipient = request.form['recipient']
        signature = request.form.get('signature', '')
        if 'signature' not in session or signature:
            session['signature'] = signature if signature else ''
        signature = session.get('signature', '')

About this template

An app that generates and sends emails using a language model, allowing users to preview and customize the content and subject before sending.
How to Use the Email Sender Pro Template on Lazy

Introduction to the Email Sender Pro Template

The Email Sender Pro template is a powerful tool that allows you to generate and send emails using a language model. This template is perfect for users who want to automate their email sending process with the ability to preview and customize the content and subject before dispatching the emails. Whether you need to send casual or formal emails, this template has got you covered.

Getting Started

To begin using the Email Sender Pro template, simply click on Start with this Template on the Lazy platform. This will pre-populate the code in the Lazy Builder interface, so you won't need to copy, paste, or delete any code.

Initial Setup

Before you can start sending emails, you'll need to set up a couple of environment secrets within the Lazy Builder. These are the EMAIL_ADDRESS and EMAIL_PASSWORD, which the application will use to authenticate with the email server and send out emails.

  • Go to the Environment Secrets tab in the Lazy Builder.
  • Click on the 'Add Secret' button.
  • Enter 'EMAIL_ADDRESS' as the key and your email address as the value.
  • Repeat the process to add the 'EMAIL_PASSWORD' secret with your email password as the value.

Please ensure you have the correct permissions and that you're using a secure and private email address for this purpose.

Test: Pressing the Test Button

Once you have set up the environment secrets, press the Test button to begin the deployment of the app. The Lazy CLI will handle the deployment process, and you won't need to install any libraries or set up your environment.

Entering Input

If the template requires user input, the Lazy App's CLI interface will prompt you to provide the necessary information after you press the test button. Follow the prompts to enter any required information.

Using the App

After deployment, Lazy will provide you with a dedicated server link to use the app. Navigate to this link to access the Email Sender Pro interface where you can compose and preview your emails.

Integrating the App

If you need to integrate the Email Sender Pro app into another service or frontend, you can use the server link provided by Lazy. Add this link to your external tool where necessary, and configure any additional settings as required by that tool.

Here's a sample request you might make to the app's API:

    POST /send HTTP/1.1<br>
    Host: [Your Lazy Server Link]<br>
    Content-Type: application/x-www-form-urlencoded<br>

And a sample response you would receive:

    HTTP/1.1 200 OK<br>
    Content-Type: text/html; charset=utf-8<br>
    Email sent successfully!

If you encounter any issues or need further assistance, refer to the documentation provided in the template or reach out to the Lazy support team for help.

Last published
July 20, 2024

More templates like this

Free Unlimited DALL-E-3 - v2

Demo at - You get the api key at


GPT-4 Exam Generator

This app uses GPT-4 to generate a PDF of a new exam based on an uploaded PDF of a past exam.


GPT-4o Reminders WhatsApp bot

This bot uses GPT-4o to give Whatsapp-based reminders to people just by chatting. In the encryption key environment secret, you need to get a 128 bit AES hex key from a website such as

Email Sender Pro