I try to send mail from admin adress :
My view :
...
if request.method == "POST":
form = contactForm(request.POST)
if form.is_valid():
sujet = form.cleaned_data['sujet']
message= form.cleaned_data['message']
try:
mail_admins(subject=sujet, message=message)
...
My settings :
EMAIL_USE_TLS = True
EMAIL_USE_SSL = True
EMAIL_HOST = 'smtp.gmail.com'
DEFAULT_FROM_EMAIL = "zor@gmail.com"
SERVER_EMAIL = "zor@gmail.com"
EMAIL_PORT = 587
EMAIL_HOST_USER = "zor@gmail.com"
EMAIL_HOST_PASSWORD = "mdp_of_zor@gmail.com"
ADMINS = [('Zorro', 'zor@gmail.com')]
But when I want to send mail from this view, I have this error :
SMTPAuthenticationError at /contact-admin
(534, '5.7.14 <https://accounts.google.com/signin/continue?sarp=1&scc=1&plt=AKgnsbsc\n5.7.14 aB9RwBxS9Q43rLo8piNoyzSjcewqxpgCnCkO6tyx-sse_8WkiANZHIGY3on1EP5iN9idsbA\n5.7.14
xE5zrQPkaGzr_Xe585DeVpze3b3zOsKI6H18hXbwiBGvWclZ8CbmjRBu7RYFniGf2PbuIiq\n5.7.14 IMnCKmefwBzOk6OjtdwJ17m8zI76vD-xo8Z8Y7Baj3d1Xd54QekL593l-8fY5LG0xzWlP9\n5.7.14 54ZNmaiSaBEkpbV-l2RxUvDM5zyaJs>
Please log in via your web browser and\n5.7.14 then try again.\n5.7.14
Learn more at\n5.7.14 https://support.google.com/mail/answer/78754 198sm222847wml.22 - gsmtp')
Why have I this error ??