Microsoft Outlook Email Sender App

import os
import smtplib
from email.message import EmailMessage

def send_email():
    email_address = os.environ['EMAIL_ADDRESS']
    email_password = os.environ['EMAIL_PASSWORD']
    to_address = input("Enter the recipient's email address: ")
    subject = input("Enter the email subject: ")
    content = input("Enter the email content: ")

    msg = EmailMessage()
    msg['Subject'] = subject
    msg['From'] = email_address
    msg['To'] = to_address

    with smtplib.SMTP('', 587) as smtp:
        smtp.login(email_address, email_password)

def main():

About this template

This app will send an email from your Microsoft account. The recipient, subject, and content of the email are provided by the user. Needs you to generate an app specific password and enter as environment secret along with the username to work.

Introduction to the Microsoft Outlook Email Sender App Template

Welcome to the Microsoft Outlook Email Sender App Template on Lazy! This template allows you to quickly set up an application that can send emails from your Microsoft account. The app will prompt you for the recipient's email address, the subject of the email, and the content you wish to send. Before you can use this template, you'll need to generate an app-specific password and set it as an environment secret along with your email address.

Getting Started with the Template

To begin using this template, click on "Start with this Template" on the Lazy platform. This will set up the template in your Lazy Builder interface, ready for customization and use.

Initial Setup: Adding Environment Secrets

The template requires two environment secrets to be set up in the Lazy Builder:

  • EMAIL_ADDRESS: Your Microsoft Outlook email address.
  • EMAIL_PASSWORD: An app-specific password for your Microsoft account.

To generate an app-specific password, follow these steps:

  1. Go to the Microsoft account security page and sign in with your Microsoft account.
  2. Under the "Security" section, find the "More security options" link and click on it.
  3. Scroll down to the "App passwords" section and click on "Create a new app password."
  4. A new app password will be generated. Copy this password.

Once you have your app-specific password, go to the Environment Secrets tab within the Lazy Builder and add the EMAIL_ADDRESS and EMAIL_PASSWORD secrets with the corresponding values.

Test: Pressing the Test Button

After setting up your environment secrets, press the "Test" button to deploy the app. The Lazy CLI will launch, and you will be prompted for any required user input.

Entering Input: Filling in User Input

When prompted by the Lazy CLI, enter the recipient's email address, the subject of the email, and the content you wish to send. The app will use these inputs to compose and send the email.

Using the App

There is no frontend interface for this app. All interactions with the app will occur through the Lazy CLI after pressing the "Test" button.

Integrating the App

If you wish to integrate this email sending functionality into another service or frontend, you may need to refer to the documentation provided by those services for how to make HTTP requests or handle SMTP operations. However, since this template is designed to work within the Lazy platform, no additional integration steps are required for the template itself.

Remember, this template is a starting point. You can customize the code to fit your specific needs or integrate it with other services as necessary. Enjoy building with Lazy!

Last published
June 15, 2024

More templates like this

PDF Data Extraction and Excel Transfer

An app for extracting name, phone number, and email data from PDF files and transferring it to Excel.


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.


Job Search Website

A customisable one-page job search website with a search bar and a search button that displays UI cards of matching jobs. You need to have a (free) account on to get the API key required for this to work.

React JS
Microsoft Outlook Email Sender App