import smtplib import datetime from email.mime.text import MIMEText def send_email(sender_email, sender_password, recipient_email, subject, message): # Create a MIMEText object msg = MIMEText(message, 'plain', 'utf-8') # Add sender and recipient information msg['From'] = sender_email msg['To'] = recipient_email msg['Subject'] = subject # Create a secure connection with the SMTP server with smtplib.SMTP('smtp.gmail.com', 587) as server: server.starttls() server.login(sender_email, sender_password) # Send the email server.sendmail(sender_email, recipient_email, msg.as_string()) if __name__ == '__main__': # Replace with your sender email address sender_email = "" # Replace with your sender email password sender_password = "" # Replace with the recipient email address recipient_email = "" # Replace with the email subject subject = "GPU finetune finished !!!" # Replace with the email message body message = f""" the finetune function finished at {datetime.datetime.now()} """ send_email(sender_email, sender_password, recipient_email, subject, message) print("Email sent successfully!")