Tengo estas líneas en el archivo << settings.py >>
EMAIL_BACKEND = "django.core.mail.backends.smtp.EmailBackend"
EMAIL_USE_TLS = True
EMAIL_HOST = "smpt.gmail.com"
EMAIL_PORT= 587
EMAIL_HOST_USER="[email protected]"
EMAIL_HOST_PASSWORD="Ejemplo"
Posteriormente al usar la shell con << python manage.py shell >> ejecuto las siguientes líneas
from django.core.mail import send_mail
send_mail("ASUNTO","CUERPO DE MENSAJE", "[email protected]",["[email protected]"],fail_silently = False)
-- Me salta el siguiente error:
Traceback (most recent call last): File "", line 1, in File "C:\Users\Aaronga\AppData\Local\Programs\Python\Python37\lib\site-packages\django\core\mail_init_.py", line 61, in send_mail return mail.send() File "C:\Users\Aaronga\AppData\Local\Programs\Python\Python37\lib\site-packages\django\core\mail\message.py", line 284, in send return self.get_connection(fail_silently).send_messages([self]) File "C:\Users\Aaronga\AppData\Local\Programs\Python\Python37\lib\site-packages\django\core\mail\backends\smtp.py", line 102, in send_messages new_conn_created = self.open() File "C:\Users\Aaronga\AppData\Local\Programs\Python\Python37\lib\site-packages\django\core\mail\backends\smtp.py", line 62, in open self.connection = self.connection_class(self.host, self.port, **connection_params) File "C:\Users\Aaronga\AppData\Local\Programs\Python\Python37\lib\smtplib.py", line 251, in init (code, msg) = self.connect(host, port) File "C:\Users\Aaronga\AppData\Local\Programs\Python\Python37\lib\smtplib.py", line 336, in connect self.sock = self._get_socket(host, port, self.timeout) File "C:\Users\Aaronga\AppData\Local\Programs\Python\Python37\lib\smtplib.py", line 307, in _get_socket self.source_address) File "C:\Users\Aaronga\AppData\Local\Programs\Python\Python37\lib\socket.py", line 707, in create_connection for res in getaddrinfo(host, port, 0, SOCK_STREAM): File "C:\Users\Aaronga\AppData\Local\Programs\Python\Python37\lib\socket.py", line 752, in getaddrinfo for res in _socket.getaddrinfo(host, port, family, type, proto, flags): socket.gaierror: [Errno 11004] getaddrinfo failed
Ya intente instalar nuevamente python, ya que vi que algunas personas pudieron solucionar el problema, pero en mi caso no se pudo solucionar.