簡體   English   中英

在 aws elasticbeanstalk 中通過 STMP 發送郵件時出錯

[英]Error in sending mail via STMP in aws elasticbeanstalk

我無法解決此錯誤。 我正在運行 django。它在我的本地運行正常,但我已將代碼部署到 aws elasticbeanstalk,它拋出以下錯誤。

我的 smtp 配置也是這樣的。

我還嘗試在 Google 設置中允許低安全應用程序。

但似乎沒有任何效果。

# SMTP configuration
EMAIL_HOST = 'smtp.gmail.com'
EMAIL_PORT = 587
EMAIL_HOST_USER = 'email@gmail.com'
EMAIL_HOST_PASSWORD = 'password'
EMAIL_USE_TLS = True

環境:

Request Method: POST
Request URL: http://odm-masala-app-env.eba-ijhfppue.us-west-2.elasticbeanstalk.com/accounts/register/

Django Version: 3.1
Python Version: 3.7.10

Installed Applications:

['django.contrib.admin',
 'django.contrib.auth',
 'django.contrib.contenttypes',
 'django.contrib.sessions',
 'django.contrib.messages',
 'django.contrib.staticfiles',
 'category',
 'accounts',
 'store',
 'carts',
 'orders',
 'admin_honeypot',
 'storages']

Installed Middleware:

['django.middleware.security.SecurityMiddleware',
 'django.contrib.sessions.middleware.SessionMiddleware',
 'django.middleware.common.CommonMiddleware',
 'django.middleware.csrf.CsrfViewMiddleware',
 'django.contrib.auth.middleware.AuthenticationMiddleware',
 'django.contrib.messages.middleware.MessageMiddleware',
 'django.middleware.clickjacking.XFrameOptionsMiddleware',
 'django_session_timeout.middleware.SessionTimeoutMiddleware']



Traceback (most recent call last):
  File "/var/app/venv/staging-LQM1lest/lib/python3.7/site-packages/django/core/handlers/exception.py", line 47, in inner
    response = get_response(request)
  File "/var/app/venv/staging-LQM1lest/lib/python3.7/site-packages/django/core/handlers/base.py", line 179, in _get_response
    response = wrapped_callback(request, *callback_args, **callback_kwargs)
  File "/var/app/current/accounts/views.py", line 53, in register
    send_email.send()
  File "/var/app/venv/staging-LQM1lest/lib/python3.7/site-packages/django/core/mail/message.py", line 284, in send
    return self.get_connection(fail_silently).send_messages([self])
  File "/var/app/venv/staging-LQM1lest/lib/python3.7/site-packages/django/core/mail/backends/smtp.py", line 102, in send_messages
    new_conn_created = self.open()
  File "/var/app/venv/staging-LQM1lest/lib/python3.7/site-packages/django/core/mail/backends/smtp.py", line 69, in open
    self.connection.login(self.username, self.password)
  File "/usr/lib64/python3.7/smtplib.py", line 730, in login
    raise last_exception
  File "/usr/lib64/python3.7/smtplib.py", line 721, in login
    initial_response_ok=initial_response_ok)
  File "/usr/lib64/python3.7/smtplib.py", line 642, in auth
    raise SMTPAuthenticationError(code, resp)

Exception Type: SMTPAuthenticationError at /accounts/register/
Exception Value: (534, b'5.7.14 <https://accounts.google.com/signin/continue?sarp=1&scc=1&plt=AKgnsbt\n5.7.14 JzmJlDR_KXwRjsGoeGbUwfJiFaseGdN7r4Tr5kVIBAWkZ_KxJtmoZ21tvxssaWR96lYr1\n5.7.14 1McFMOBeAoLgjKAhaZSf7Z0H7mCYUPyXbKlQ-CmDohYCNFK3GmWZG47EBOB2uOnH>\n5.7.14 Please log in via your web browser and then try again.\n5.7.14  Learn more at\n5.7.14  https://support.google.com/mail/answer/78754 63sm12202837pfz.119 - gsmtp')

這是因為 gmail 使用驗證碼驗證,請嘗試從下面的鏈接禁用它。 https://accounts.google.com/DisplayUnlockCaptcha

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM