you can use the function send mail of django Téléchargez Outlook pour iOS<https://aka.ms/o0ukef> ________________________________ De : django-users@googlegroups.com <django-users@googlegroups.com> de la part de It's Aladdin <iamaladdi...@gmail.com> Envoyé : Wednesday, November 9, 2022 12:06:33 PM À : django-users@googlegroups.com <django-users@googlegroups.com> Objet : Re: Email Sending In Django not working
Google hast stopped less secure apps, so u cant send email messages anymore with ur email and password, U will have to find some other way of sending mails. On Wed, 9 Nov, 2022, 16:26 peteru mimo, <peterumi...@gmail.com<mailto:peterumi...@gmail.com>> wrote: Good day team, I have been facing this challenge in sending mail in django here is the error "A connection attempt failed because the connected party did not properly respond after a period of time, or established connection failed because connected host has failed to respond" Code def send_verification_email(request, user): from_email = settings.DEFAULT_FROM_EMAIL current_site = get_current_site(request) mail_subject = 'Please activate your account' message = render_to_string('accounts/emails/account_verification_email.html', { 'user': user, 'domain': current_site, 'uid': urlsafe_base64_encode(force_bytes(user.pk<http://user.pk>)), 'token': default_token_generator.make_token(user), }) to_email = user.email mail = EmailMessage(mail_subject, from_email, message, to=[to_email]) mail.send() Settings EMAIL_HOST = 'smtp.google.com<http://smtp.google.com>' EMAIL_POST = '587' EMAIL_HOST_USER = 'myemail' EMAIL_HOST_PASSWORD = 'email_password' EMAIL_USE_TLS = True Any solution will be appreciated. Thank you -- You received this message because you are subscribed to the Google Groups "Django users" group. To unsubscribe from this group and stop receiving emails from it, send an email to django-users+unsubscr...@googlegroups.com<mailto:django-users+unsubscr...@googlegroups.com>. To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/1ed5b9fc-3370-413c-b4cb-edeb2451d8f4n%40googlegroups.com<https://groups.google.com/d/msgid/django-users/1ed5b9fc-3370-413c-b4cb-edeb2451d8f4n%40googlegroups.com?utm_medium=email&utm_source=footer>. -- You received this message because you are subscribed to the Google Groups "Django users" group. To unsubscribe from this group and stop receiving emails from it, send an email to django-users+unsubscr...@googlegroups.com<mailto:django-users+unsubscr...@googlegroups.com>. To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/CAA5HNVoRdTC2BBZ2FEk1ETaqxfL5xKQgfBuAcbFdPES_bSRYmQ%40mail.gmail.com<https://groups.google.com/d/msgid/django-users/CAA5HNVoRdTC2BBZ2FEk1ETaqxfL5xKQgfBuAcbFdPES_bSRYmQ%40mail.gmail.com?utm_medium=email&utm_source=footer>. -- You received this message because you are subscribed to the Google Groups "Django users" group. To unsubscribe from this group and stop receiving emails from it, send an email to django-users+unsubscr...@googlegroups.com. To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/AS8P193MB1158CD635697F8E3E8596FF0AE3E9%40AS8P193MB1158.EURP193.PROD.OUTLOOK.COM.