import smtplib import ssl def send_email( email_data, config_dict: dict, ): # Configure SSL context if needed context = ssl.create_default_context() if not config_dict["verify_cert"]: context.check_hostname = False context.verify_mode = ssl.CERT_NONE with smtplib.SMTP_SSL( config_dict["smtp_server"], config_dict["smtp_port"], context=context ) as server: server.login(config_dict["smtp_username"], config_dict["smtp_password"]) server.send_message(email_data)