Jul-04-2020, 07:53 AM
Now that I have removed the safeties from Gmail, I can send the email:
My question now is: how can I add a subject to the email?
Thank you
import smtplib, ssl sender_email = "me@gmail" receiver_email = "[email protected]" message = "Hello, world" print("sending email") ctx=ssl.create_default_context() with smtplib.SMTP_SSL("smtp.gmail.com", 465, context=ctx) as server: server.login("me", password) server.sendmail(sender_email, receiver_email, message) print("sent")Probably there is a better way, in particular without the use of SSL (but when I tried
smtplit.SMTP
only, it did not work.My question now is: how can I add a subject to the email?
Thank you