Я пытаюсь включить django-ses в свой проект. Я следовал инструкциям, изложенным в этом руководстве: https://kholinlabs.com/the-easiest-way-to-send-emails-with-django
Хотя я считаю, что внимательно следил за ними, при отправке тестового электронного письма я получаю эту ошибку:
File "/usr/local/Cellar/python/3.6.5_1/Frameworks/Python.framework/Versions/3.6/lib/python3.6/socket.py", line 745, in getaddrinfo
for res in _socket.getaddrinfo(host, port, family, type, proto, flags):
socket.gaierror: [Errno 8] nodename nor servname provided, or not known
IЯ успешно зарегистрировался в SES и подтвердил адрес электронной почты, который я использую для отправки.
Ошибка возникает при отправке с консоли python или из приложения.
Это мои соответствующие настройки:
EMAIL_BACKEND = 'django_ses.SESBackend'
AWS_SES_REGION_NAME = 'eu-west-2'
AWS_SES_REGION_ENDPOINT = 'email.eu-west-2.amazonaws.com'
AWS_SES_ACCESS_KEY_ID = '{secret key}'
AWS_SES_SECRET_ACCESS_KEY = '{secret access key}'
AWS_SES_AUTO_THROTTLE = 0.5
Как это исправить?
Команда, используемая для отправки emaik
from django.core.mail import send_mail
send_mail(
'Subject here',
'Here is the message.',
'from@example.com',
['to@example.com'],
fail_silently=False,
)
Трассировка полного стека
Traceback (most recent call last):
File "/Applications/PyCharm.app/Contents/helpers/pydev/pydevd.py", line 1758, in <module>
main()
File "/Applications/PyCharm.app/Contents/helpers/pydev/pydevd.py", line 1752, in main
globals = debugger.run(setup['file'], None, None, is_module)
File "/Applications/PyCharm.app/Contents/helpers/pydev/pydevd.py", line 1147, in run
pydev_imports.execfile(file, globals, locals) # execute the script
File "/Applications/PyCharm.app/Contents/helpers/pydev/_pydev_imps/_pydev_execfile.py", line 18, in execfile
exec(compile(contents+"\n", file, 'exec'), glob, loc)
File "/Users/user/Desktop/app/manage.py", line 15, in <module>
execute_from_command_line(sys.argv)
File "/Users/user/python-venvs/app/lib/python3.6/site-packages/django/core/management/__init__.py", line 381, in execute_from_command_line
utility.execute()
File "/Users/user/python-venvs/app/lib/python3.6/site-packages/django/core/management/__init__.py", line 375, in execute
self.fetch_command(subcommand).run_from_argv(self.argv)
File "/Users/user/python-venvs/app/lib/python3.6/site-packages/django/core/management/base.py", line 323, in run_from_argv
self.execute(*args, **cmd_options)
File "/Users/user/python-venvs/app/lib/python3.6/site-packages/django/core/management/base.py", line 364, in execute
output = self.handle(*args, **options)
File "/Users/user/Desktop/app/letters/management/commands/test_email.py", line 19, in handle
fail_silently=False,
File "/Users/user/python-venvs/app/lib/python3.6/site-packages/django/core/mail/__init__.py", line 60, in send_mail
return mail.send()
File "/Users/user/python-venvs/app/lib/python3.6/site-packages/django/core/mail/message.py", line 291, in send
return self.get_connection(fail_silently).send_messages([self])
File "/Users/user/python-venvs/app/lib/python3.6/site-packages/django_ses/__init__.py", line 157, in send_messages
rate_limit = self.get_rate_limit()
File "/Users/user/python-venvs/app/lib/python3.6/site-packages/django_ses/__init__.py", line 247, in get_rate_limit
quota_dict = self.connection.get_send_quota()
File "/Users/user/python-venvs/app/lib/python3.6/site-packages/boto/ses/connection.py", line 341, in get_send_quota
return self._make_request('GetSendQuota')
File "/Users/user/python-venvs/app/lib/python3.6/site-packages/boto/ses/connection.py", line 102, in _make_request
data=urllib.parse.urlencode(params)
File "/Users/user/python-venvs/app/lib/python3.6/site-packages/boto/connection.py", line 1071, in make_request
retry_handler=retry_handler)
File "/Users/user/python-venvs/app/lib/python3.6/site-packages/boto/connection.py", line 1030, in _mexe
raise ex
File "/Users/user/python-venvs/app/lib/python3.6/site-packages/boto/connection.py", line 943, in _mexe
request.body, request.headers)
File "/usr/local/Cellar/python/3.6.5_1/Frameworks/Python.framework/Versions/3.6/lib/python3.6/http/client.py", line 1239, in request
self._send_request(method, url, body, headers, encode_chunked)
File "/usr/local/Cellar/python/3.6.5_1/Frameworks/Python.framework/Versions/3.6/lib/python3.6/http/client.py", line 1285, in _send_request
self.endheaders(body, encode_chunked=encode_chunked)
File "/usr/local/Cellar/python/3.6.5_1/Frameworks/Python.framework/Versions/3.6/lib/python3.6/http/client.py", line 1234, in endheaders
self._send_output(message_body, encode_chunked=encode_chunked)
File "/usr/local/Cellar/python/3.6.5_1/Frameworks/Python.framework/Versions/3.6/lib/python3.6/http/client.py", line 1026, in _send_output
self.send(msg)
File "/usr/local/Cellar/python/3.6.5_1/Frameworks/Python.framework/Versions/3.6/lib/python3.6/http/client.py", line 964, in send
self.connect()
File "/Users/user/python-venvs/app/lib/python3.6/site-packages/boto/https_connection.py", line 119, in connect
sock = socket.create_connection((self.host, self.port), self.timeout)
File "/usr/local/Cellar/python/3.6.5_1/Frameworks/Python.framework/Versions/3.6/lib/python3.6/socket.py", line 704, in create_connection
for res in getaddrinfo(host, port, 0, SOCK_STREAM):
File "/usr/local/Cellar/python/3.6.5_1/Frameworks/Python.framework/Versions/3.6/lib/python3.6/socket.py", line 745, in getaddrinfo
for res in _socket.getaddrinfo(host, port, family, type, proto, flags):
socket.gaierror: [Errno 8] nodename nor servname provided, or not known
Process finished with exit code 1