TypeError: User has no len() Getting this error when i try to get send mail

Internal Server Error: /forget_pass/
Traceback (most recent call last):
  File "/usr/lib/python3/dist-packages/django/core/handlers/exception.py", line 34, in inner
    response = get_response(request)
  File "/usr/lib/python3/dist-packages/django/core/handlers/base.py", line 115, in _get_response
    response = self.process_exception_by_middleware(e, request)
  File "/usr/lib/python3/dist-packages/django/core/handlers/base.py", line 113, in _get_response
    response = wrapped_callback(request, *callback_args, **callback_kwargs)
  File "/home/goameer030/Danker-Man/danker_man/mainapp/views.py", line 258, in Forgetpass
    mail_for_pass(user_obj, token)
  File "/home/goameer030/Danker-Man/danker_man/mainapp/helpers.py", line 9, in mail_for_pass
    send_mail(subject, message, email_from, [email])
  File "/usr/lib/python3/dist-packages/django/core/mail/__init__.py", line 60, in send_mail
    return mail.send()
  File "/usr/lib/python3/dist-packages/django/core/mail/message.py", line 306, in send
    return self.get_connection(fail_silently).send_messages([self])
  File "/usr/lib/python3/dist-packages/django/core/mail/backends/smtp.py", line 110, in send_messages
    sent = self._send(message)
  File "/usr/lib/python3/dist-packages/django/core/mail/backends/smtp.py", line 123, in _send
    recipients = [sanitize_address(addr, encoding) for addr in email_message.recipients()]
  File "/usr/lib/python3/dist-packages/django/core/mail/backends/smtp.py", line 123, in <listcomp>
    recipients = [sanitize_address(addr, encoding) for addr in email_message.recipients()]
  File "/usr/lib/python3/dist-packages/django/core/mail/message.py", line 105, in sanitize_address
    addr = parseaddr(addr)
  File "/usr/lib/python3.9/email/utils.py", line 212, in parseaddr
    addrs = _AddressList(addr).addresslist
  File "/usr/lib/python3.9/email/_parseaddr.py", line 509, in __init__
    self.addresslist = self.getaddrlist()
  File "/usr/lib/python3.9/email/_parseaddr.py", line 252, in getaddrlist
    while self.pos < len(self.field):
TypeError: object of type 'User' has no len()

Getting this error when I try to get send a mail.

helpers.py

def mail_for_pass(email, token):
	subject = "Reset Password"
	message = f'Click the link to change your password http://127.0.0.1:8000/re_pass/{token}/'
	email_from = settings.EMAIL_HOST_USER
	send_mail(subject, message, email_from, [email])
	return 1

views.py

def Forgetpass(request):
    if request.method == 'POST':
        username = request.POST.get('username')

        if not User.objects.filter(username=username).first():
            messages.success(request, 'No user found with user username')
            return redirect('forgetpass')

        user_obj = User.objects.get(username=username)
        token = str(uuid.uuid4())

        forgetpass_obj = ForgetPass.objects.get(U_User=user_obj)
        forgetpass_obj.F_P_TO = token
        forgetpass_obj.save()

        mail_for_pass(user_obj, token)
        messages.success(request, 'Check your Email Inbox')
        return redirect('forgetpass')

    return render(request, 'registration/forgetpass.html')

At this point, you’re passing an instance of User to your function.

However, your function looks like it’s expecting to be passed an email address.

You need to either pass the User’s email address to the function, or change the function to retrieve the email address from the supplied User object.