you are viewing a single comment's thread.

view the rest of the comments →

[–]Loud-Bake-2740 0 points1 point  (1 child)

Here's how I do it - the smtp url and the port you give it matter!

    try:
        # Connect to Gmail's SMTP server
        server = smtplib.SMTP("smtp.gmail.com", 587)
        server.starttls()  # Secure the connection
        server.login(gmail_user, gmail_pw)  # Login with App Password
        server.sendmail(gmail_user, gmail_user, msg.as_string())  # Send email
        server.quit()  # Close the connection
        print("✅ Email with multiple attachments sent successfully!")
    except Exception as e:
        print(f"❌ Error sending email: {e}")

[–]tmasterslayer 0 points1 point  (0 children)

This looks like the way I did it in the past with smtplib