我试图在 AWS 上设置一个 Weblate 实例来发送密码重置电子邮件。我按照以下步骤操作:
pip install boto
pip install django-ses
sudo vim /opt/bitnami/apps/django/lib/python3.7/site-packages/Django-2.1.4-py3.7.egg/django/conf/global_settings.py
EMAIL_BACKEND = 'django_ses.SESBackend'
AWS_ACCESS_KEY_ID = 'xxxx'
AWS_SECRET_ACCESS_KEY = 'xxx'
但是它仍然无法正常工作,并且我没有收到任何错误。我的 AWS 密钥拥有 SES 的完全权限。
更新:
如果我运行 send_mail 从./manage.py shell
我得到这个输出:
>>> send_mail('Subject here', 'Here is the message.', 'xx@gmail.com',['xx@gmail.com'], fail_silently=False)
Traceback (most recent call last):
File "<console>", line 1, in <module>
File "/opt/bitnami/apps/weblate/venv/lib/python3.7/site-packages/django/core/mail/__init__.py", line 60, in send_mail
return mail.send()
File "/opt/bitnami/apps/weblate/venv/lib/python3.7/site-packages/django/core/mail/message.py", line 291, in send
return self.get_connection(fail_silently).send_messages([self])
File "/opt/bitnami/apps/weblate/venv/lib/python3.7/site-packages/django/core/mail/backends/smtp.py", line 103, in send_messages
new_conn_created = self.open()
File "/opt/bitnami/apps/weblate/venv/lib/python3.7/site-packages/django/core/mail/backends/smtp.py", line 63, in open
self.connection = self.connection_class(self.host, self.port, **connection_params)
File "/opt/bitnami/python/lib/python3.7/smtplib.py", line 251, in __init__
(code, msg) = self.connect(host, port)
File "/opt/bitnami/python/lib/python3.7/smtplib.py", line 336, in connect
self.sock = self._get_socket(host, port, self.timeout)
File "/opt/bitnami/python/lib/python3.7/smtplib.py", line 307, in _get_socket
self.source_address)
File "/opt/bitnami/python/lib/python3.7/socket.py", line 727, in create_connection
raise err
File "/opt/bitnami/python/lib/python3.7/socket.py", line 716, in create_connection
sock.connect(sa)
ConnectionRefusedError: [Errno 111] Connection refused