I was trying to add ALLAUTH to my django app
Settings:
EMAIL_BACKEND = 'django.core.mail.backends.smtp.EmailBackend'
EMAIL_HOST = "smtp.gmail.com"
EMAIL_USE_TLS = True
EMAIL_PORT = 587
EMAIL_HOST_USER = "xxxxxx#gmail.com"
EMAIL_HOST_PASSWORD = "xxxxxxxx"
urls.py
path("accounts/user/<pk>", views.OtherProfileView.as_view(), name='profile_view'),
path("password/change/", PasswordChangeView.as_view(
template_name='accounts/password_change.html',
success_url="/",
form_class=PasswordChangeForm),
name='password_change'),
path("passoword/reset/", views.CustomPasswordReset.as_view(),
name='password_reset'),
path("password/reset/confirm/<uidb64>/<token>/",
PasswordResetConfirmView.as_view(
template_name='accounts/password_reset_confirm.html'),
name='password_reset_confirm')
I expected email will recieve me email reset to my mai`
Related
I am trying to implement the 'password-reset' functionality using django. I set up my urls:
path('account/reset_password/', auth_views.PasswordResetView.as_view(), name='reset_password'),
path('account/reset_password_sent/', auth_views.PasswordResetDoneView.as_view(), name='password_reset_done'),
path('account/reset/<uidb64>/<token>', auth_views.PasswordResetConfirmView.as_view(), name='password_reset_confirm'),
path('account/reset_password_complete/', auth_views.PasswordResetCompleteView.as_view(), name='password_reset_complete'),
and the Settings.py:
EMAIL_FILE_PATH = f"{BASE_DIR}/sent_emails"
EMAIL_BACKEND = 'django.core.mail.backends.smtp.EmailBackend'
EMAIL_HOST = 'smtp-mail.outlook.com'
EMAIL_PORT = '587'
EMAIL_USE_TLS = True
EMAIL_HOST_USER = 'someaccount#outlook.com'
DEAFULT_FROM_EMAIL = EMAIL_HOST_USER
EMAIL_HOST_PASSWORD = 'somepassword'
No emails are sent from the host email. I tried using console.EmailBackend and an email is indeed written, a working reset link is provided in the email. Everything works besides sending the email to the receiver address. Is there something wrong with the settings?
Here are the Django simple SMTP backend settings for just 1 email account
EMAIL_BACKEND = 'django.core.mail.backends.smtp.EmailBackend'
EMAIL_HOST = "mail.mysmtpserver.somewhere"
EMAIL_PORT = 587
EMAIL_HOST_USER = "my#login"
EMAIL_HOST_PASSWORD = "mypassword"
EMAIL_USE_TLS = True
How is it possible to use 2 or more email accounts on the same server instead of one?
EMAIL_BACKEND = 'django.core.mail.backends.smtp.EmailBackend'
EMAIL_HOST = "mail.mysmtpserver.somewhere"
EMAIL_PORT =587
EMAIL_HOST_USER = "my#login2"
EMAIL_HOST_PASSWORD = "mypassword2"
EMAIL_USE_TLS = True
I just need to send different emails based on the subject by different email account.
I checked the Django documentation but there was nothing
django settings config
EMAIL_BACKEND = 'django.core.mail.backends.smtp.EmailBackend'
EMAIL_HOST = 'smtp.office365.com'
EMAIL_PORT = 587
EMAIL_HOST_USER = 'myemail#outlook.com'
EMAIL_HOST_PASSWORD = 'myPassword'
EMAIL_USE_TLS = True
EMAIL_USE_SSL = False
it shows error smtplib.SMTPAuthenticationError: (535, b'5.7.3 Authentication unsuccessful [BM1P287CA0013.INDP287.PROD.OUTLOOK.COM]')
i try to make setting for send message to user when they create account or rest password ( i use all auth ) ,, but when try to create acc to ex the page just still loading , it don't do anything
how to fix it
# email message send
EMAIL_BACKEND = 'django.core.mail.backends.smtp.EmailBackend'
EMAIL_HOST= 'mail.filltasks.live'
EMAIL_HOST_USER= 'no-reply#filltasks.live'
EMAIL_HOST_PASSWORD= 'mypass_namecheap_acc'
EMAIL_USE_TLS= True
EMAIL_PORT= 465
DEFAULT_FROM_EMAIL = EMAIL_HOST_USER
edit it do that and worked fine !!!!
EMAIL_BACKEND = 'django.core.mail.backends.smtp.EmailBackend'
EMAIL_HOST = 'mail.yourdomain' # for ex ,, mail.site.com
EMAIL_HOST_USER = 'no-reply#filltasks.live'
DEFAULT_FROM_EMAIL = EMAIL_HOST_USER
EMAIL_HOST_PASSWORD = ' the password for your email not your account'
EMAIL_PORT = 587
EMAIL_USE_SSL = False
EMAIL_USE_TLS = True
thanks for
https://stackoverflow.com/a/48750034/19161837
EMAIL_BACKEND = 'django.core.mail.backends.smtp.EmailBackend'
EMAIL_HOST = 'mail.yourdomain' # for ex ,, mail.site.com
EMAIL_HOST_USER = 'no-reply#filltasks.live'
DEFAULT_FROM_EMAIL = EMAIL_HOST_USER
EMAIL_HOST_PASSWORD = ' the password for your email not your account'
EMAIL_PORT = 587
EMAIL_USE_SSL = False
EMAIL_USE_TLS = True
thanks for
best answer
I want to send mail after form valid. So i using EmailMessage class .
My code like this.
EmailMessage(subject='ddd', body='ff2', from_email='test#gmail.com', to=['test#gmail.com'], reply_to=['test#gmail.com'], headers={}).send()
This code work very well in django shell. But not work when i use to in django views.
EMAIL_BACKEND = 'django.core.mail.backends.smtp.EmailBackend'
EMAIL_USE_TLS = True
EMAIL_HOST = 'smtp.gmail.com'
EMAIL_HOST_USER = 'test#gmail.com'
EMAIL_HOST_PASSWORD = password_create_with_google_app
EMAIL_PORT = 587
DEFAULT_FROM_EMAIL = EMAIL_HOST_USER