import smtplib
from email.mime.text import MIMEText
from email.mime.multipart import MIMEMultipart
import schedule
import time
def send_email():
# Set up the email server
server = smtplib.SMTP('your_smtp_server.com', 587)
server.starttls()
# Login to your email account
server.login('your_email@example.com', 'your_email_password')
# Create the email message
msg = MIMEMultipart()
msg['From'] = 'your_email@example.com'
msg['To'] = 'recipient@example.com'
msg['Subject'] = 'Daily Report'
# Add the content of your report
body = 'Your daily report content here.'
msg.attach(MIMEText(body, 'plain'))
# Send the email
server.sendmail('your_email@example.com', 'recipient@example.com', msg.as_string())
# Quit the server
server.quit()
# Schedule the script to run daily at a specific time
schedule.every().day.at('08:00').do(send_email)
# Keep the script running
while True:
schedule.run_pending()
time.sleep(1)