GarryGon4ar / pyconverter

Converter from link of youtube video to mp3, without Django Framework
0 stars 0 forks source link

Add email field , add file for environmental variables and send email. #6

Open GarryGon4ar opened 5 years ago

GarryGon4ar commented 5 years ago
  1. Add email field into form and get email from user where to send message.
  2. Add .env file to store environmental variables
  3. Send simple email to user with any message.
GarryGon4ar commented 5 years ago

AttributeError: module 'dotenv' has no attribute 'read_dotenv' error, can't load environmental variables with dotenv in python

GarryGon4ar commented 5 years ago

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)