Email Sender Pro

By
 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__)
Bootstrap(app)
app.config['SECRET_KEY'] = 'a_very_secret_key'

EMAIL_ADDRESS = os.environ.get('EMAIL_ADDRESS')
EMAIL_PASSWORD = os.environ.get('EMAIL_PASSWORD')

@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>
    <br>
    email_content=Your%20email%20content&recipient=recipient@example.com&email_subject=Your%20Subject

And a sample response you would receive:


    HTTP/1.1 200 OK<br>
    Content-Type: text/html; charset=utf-8<br>
    <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.

Category
Technology
Last published
April 7, 2024

More templates like this

Lazy Image to Video

Lazy Image to Video using stability ai to generate video clips based on their image to video model.

OpenAI
Stability AI

DALL-E 3 QuickStart API

Do you want to integrate with DALL-E 3 quickly? Well, all you need for this API to work is your OpenAI API key and you have a usable DALL-E 3 server in minutes! It takes in a prompt and responds with a URL to your new image.

OpenAI

AI Query Generator Slack Bot for BigQuery

This app allows users to interact with a Slack bot, ask a question about the data in a table or request the table schema, and then uses the latest ChatGPT to generate a query that is executed on BigQuery to return the results. The app includes a retry mechanism for query generation in case of an error (up to two retries) and provides the LLM with the table info to generate more accurate queries. The table schema is only printed if it is successfully retrieved. All errors from retries are now passed to the LLM. The generated query is printed before the results, and the results are displayed in a pretty table format. The bot uses the Slack API to send and receive messages and parses the user's message to determine the action to take. The bot always responds in a thread to the original message.

Python
Slack
OpenAI
Home
/
Email Sender Pro