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
|
title: Send Email
|
||||||
author: Josh Knapp
|
author: Josh Knapp
|
||||||
version: 0.4.0
|
version: 0.7.0
|
||||||
description="Send email via SMTP to user specificed address"
|
description: "Send email via SMTP to user specificed address"
|
||||||
|
requirements: smtplib, email
|
||||||
"""
|
"""
|
||||||
|
|
||||||
import subprocess, sys
|
import subprocess, sys
|
||||||
from pydantic import BaseModel, Field
|
from pydantic import BaseModel, Field
|
||||||
|
import smtplib
|
||||||
|
from email.mime.text import MIMEText
|
||||||
# Try to import required packages, install if not present
|
from email.mime.multipart import MIMEMultipart
|
||||||
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)}")
|
|
||||||
|
|
||||||
|
|
||||||
class Tools:
|
class Tools:
|
||||||
class Valves(BaseModel):
|
class Valves(BaseModel):
|
||||||
|
Loading…
x
Reference in New Issue
Block a user