0
@login_required(login_url="/login/")
def api_view(request):
    if request.method == "POST":
        subs = str(request.POST.get("subs")).capitalize()
        subs = ast.literal_eval(subs)
       # javascript true to Python True
        user_name = request.user.get_username()
        
        email = request.user.email
   
        if subs:
            send_mail(
        "Congratulations for subscription",
        "Thank you for showing interest!we appreciate your efforts",
        "fromemail@gmail.com",
        [email],
        fail_silently=False,)

this is my settings.py file

import os 

EMAIL_HOST = "smtp.gmail.com"
Email_PORT = 587
EMAIL_HOST_USER ="fromemail@gmail.com"
EMAIL_HOST_PASSWORD = os.environ.get('pass_wd')
EMAIL_USE_TLS = True

TimeoutError: [WinError 10060] 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

athar
  • 31
  • 4

0 Answers0