import smtplib import io from email.mime.text import MIMEText from email.mime.multipart import MIMEMultipart from email.mime.image import MIMEImage def send_email_with_attachment(sender_email, password, to_email, subject, image_bytes): """ Sends an email with an image attachment. Args: sender_email (str): The sender's email address. password (str): The sender's email password. to_email (str): The recipient's email address. subject (str): The subject of the email. image_bytes (bytes): The image content as a byte string. """ message = MIMEMultipart('alternative') message['Subject'] = subject message['From'] = sender_email message['To'] = to_email html_content = """
Thank you for your interest in the BuffTeks student organization!
Wishing you a spooktacular Halloween!
Here is your special holiday photo generated just for you.
Enjoy and have a frightfully fun day!