Delete mailtest.py
This commit is contained in:
parent
2a72b2da44
commit
cbf0ce91b8
30
mailtest.py
30
mailtest.py
@ -1,30 +0,0 @@
|
||||
import smtplib
|
||||
from email.mime.text import MIMEText
|
||||
|
||||
gmail_user = 'aaron@crate.zip'
|
||||
gmail_password = 'mjir axgh nzdy goxx'
|
||||
recipient_email = 'crateimage@gmail.com'
|
||||
|
||||
def send_email(subject, body, recipient_email, gmail_user, gmail_password):
|
||||
msg = MIMEText(body)
|
||||
msg['Subject'] = subject
|
||||
msg['From'] = gmail_user
|
||||
msg['To'] = recipient_email
|
||||
|
||||
try:
|
||||
with smtplib.SMTP('smtp.gmail.com', 587) as server:
|
||||
server.starttls()
|
||||
server.login(gmail_user, gmail_password)
|
||||
server.send_message(msg)
|
||||
print("Message sent.")
|
||||
except Exception as e:
|
||||
print(f"Failed to send email: {e}")
|
||||
|
||||
send_email(
|
||||
"Power Outage Detected",
|
||||
"The UPS is running on battery power!",
|
||||
recipient_email,
|
||||
gmail_user,
|
||||
gmail_password
|
||||
)
|
||||
|
Loading…
Reference in New Issue
Block a user