Merge pull request 'update to use requirements' (#1) from switch-to-requirements into main
Reviewed-on: #1
This commit is contained in:
commit
7d4a13e02f
@ -1,29 +1,16 @@
|
||||
"""
|
||||
title: Send Email
|
||||
author: Josh Knapp
|
||||
version: 0.4.0
|
||||
description="Send email via SMTP to user specificed address"
|
||||
version: 0.7.0
|
||||
description: "Send email via SMTP to user specificed address"
|
||||
requirements: smtplib, email
|
||||
"""
|
||||
|
||||
import subprocess, sys
|
||||
from pydantic import BaseModel, Field
|
||||
|
||||
|
||||
# Try to import required packages, install if not present
|
||||
try:
|
||||
import smtplib
|
||||
from email.mime.text import MIMEText
|
||||
from email.mime.multipart import MIMEMultipart
|
||||
except ImportError:
|
||||
print("Packages not found. Attempting to install...")
|
||||
try:
|
||||
subprocess.check_call([sys.executable, "-m", "pip", "install", "smtplib"])
|
||||
subprocess.check_call([sys.executable, "-m", "pip", "install", "email"])
|
||||
|
||||
print("Packages installed successfully")
|
||||
except subprocess.CalledProcessError as e:
|
||||
print(f"Failed to install packages: {str(e)}")
|
||||
|
||||
import smtplib
|
||||
from email.mime.text import MIMEText
|
||||
from email.mime.multipart import MIMEMultipart
|
||||
|
||||
class Tools:
|
||||
class Valves(BaseModel):
|
||||
|
Loading…
x
Reference in New Issue
Block a user