Open GarryGon4ar opened 5 years ago
AttributeError: module 'dotenv' has no attribute 'read_dotenv' error, can't load environmental variables with dotenv in python
Solved problem with environmental variables, and now connection failing AttributeError: 'SMTP' object has no attribute 'sock'
sender_email = os.getenv('sender_email')
receiver_email = email # Enter receiver address
password = os.getenv('password')
message = "Subject: Hi there. This message is sent from Python."
context = ssl.create_default_context()
with smtplib.SMTP(smtp_server, port) as server:
server.starttls(context=context)
server.login(sender_email, password)
server.sendmail(sender_email, receiver_email, message)
problem is happening on line server.starttls(context=context)