Sending Emails with Python
How do I send emails with python, I've tried using:
import smtplib, ssl
port = 0 # For SSL
password = "URmom"
context = ssl.create_default_context()
with smtplib.SMTP_SSL("[email protected]", port, context=context) as server:
server.login("[email protected]", password)
# TODO: Send email here
server.sendmail("[email protected]", "[email protected]", "Bob is cool")
thanks everybody, this was super helpful.
Set up the SMTP server and log into your account.
Create the MIMEMultipart message object and load it with appropriate headers for From , To , and Subject fields.
Add your message body.
Send the message using the SMTP server object.
If this helped then choose this as the answer you were looking for!