Code Monkey home page Code Monkey logo

mails-scheduler's Introduction

Mail Scheduler

A mail scheduler program is a software tool designed to automatically send emails with attachements (e.g. PDF files) at specific times every day.

Installation packages

Use the package manager pip to install the following packages.

pip install smtplib
pip install schedule
pip install email
pip install datetime

Run the scheduler:

  1. Clone the Repository:

    • Run the following command to clone the repository:
    git clone https://github.com/Mostafa-Medhat/Mails-Scheduler.git
  2. Open the Python Script:

    • Navigate into the cloned repository directory.

    • Use any text editor or Integrated Development Environment (IDE) to open the mail_scheduler.py file.

    • Change the Email Content:

    Inside the mail_scheduler.py file, locate the section where the email content is defined. Modify the content of the email, including the subject, body, recipient's email address, and any attachments if needed, to your desired values.

    # Add a text part (description/content) to the email
        email_content = """Hello,
    
    Please find the attached PDF file for your reference.
    
    Regards,
    Your Name
    """
    • Change/Remove Attached File:

    If you want to attach a file, make sure the file exists in the same directory as the Python script. Update the file path in the script accordingly. If you don't want to attach a file, you can remove or comment out the lines of code related to attaching a file.

      # Attach the PDF file
        SendFile = 'Your File.pdf'
        with open(SendFile, 'rb') as pdf_file:
            pdf_attachment = MIMEApplication(pdf_file.read(), _subtype="pdf")
            pdf_attachment.add_header('content-disposition', 'attachment', filename=SendFile)
        msg.attach(pdf_attachment)
    • Change Time Settings: Modify the scheduled time by changing "19:00" to your desired time, following the format HH:MM (24-hour format).
    # Schedule the email to be sent daily at a specific time (e.g., 19:00 "7:00 PM")
    schedule.every().day.at("19:00").do(send_email)
    • Save the Changes.
  3. Run the script:

    • Open Command Prompt in the the mail_scheduler directory and type the following command:
    python mail_scheduler.py
    • This command will execute the Python script, which will schedule and send the email according to the specified time settings.

Future Version:

Future versions of the mail scheduler will include a user interface (UI) instead of a script-based approach.

mails-scheduler's People

Contributors

mostafa-medhat avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.