Объект 'int' не имеет атрибута 'encode' ошибка при отправке почты в django

Я получил эту ошибку при отправке электронной почты.

def registration(request):
    if request.method == 'POST':
        
        username = request.POST['username']
        first_name = request.POST['first_name']
        last_name = request.POST['last_name']
        email = request.POST['email']
        password = request.POST['password']
        
        if User.objects.filter(username = username).exists():
            messages.info(request,'Username taken')
            return redirect('registration')
        elif User.objects.filter(email = email).exists(): 
            messages.info(request,'Email id is already registered')
            return redirect('registration') 
        else:    
            user = User.objects.create_user(username=username, password= password, email= email, first_name = first_name,last_name = last_name)         
            user.save()
            auth_token = str(uuid.uuid4())
            print('done')
            print(auth_token , email)
            send_mail_after_registration(auth_token , email)
            profile_obj = Profile.objects.create(user=user , auth_token = auth_token )
            profile_obj.save()
            
            return render(request, 'token_check.html')
    else:
        return render(request, 'registration.html')

def send_mail_after_registration(ctoken , email):
   
    print("hiii")
    subject = 'Your account need to verified- MyTrip'
    message = 'Hello, \n We are excited to have you get started. First, you need to confirm your account. Just press the Link below. \n  Or paste the link in browser to verify `your account http://127.0.0.1:8000/verify/'+ctoken + '\n \n If you have any questions, just reply to this email—we are always happy to help out. \n Cheers, \n The MyTrip Team'
    email_from = settings.EMAIL_HOST_USER
    recipient_list = [email]
    print("hii")
    #msg=EmailMessage(subject,message,to=recipient_list)
    #msg.send()
    send_mail(subject, message, email_from, recipient_list)

Описание ошибки:

AttributeError at /registration/

'int' object has no attribute 'encode'

Request Method: POST

Request URL:    http://127.0.0.1:8000/registration/

Django Version: 3.2.6

Exception Type: AttributeError

Exception Value:    
'int' object has no attribute 'encode'

Exception Location: c:\users\prachi\appdata\local\programs\python\python39\lib\smtplib.py, line 647, in auth

Python Executable:  C:\Users\prachi\Envs\test\Scripts\python.exe

Python Version: 3.9.5

Python Path:    
['C:\\Users\\prachi\\projects\\travele2',
 'c:\\users\\prachi\\appdata\\local\\programs\\python\\python39\\python39.zip',
 'c:\\users\\prachi\\appdata\\local\\programs\\python\\python39\\DLLs',
 'c:\\users\\prachi\\appdata\\local\\programs\\python\\python39\\lib',
 'c:\\users\\prachi\\appdata\\local\\programs\\python\\python39',
 'C:\\Users\\prachi\\Envs\\test',
 'C:\\Users\\prachi\\Envs\\test\\lib\\site-packages']

Server time:    Thu, 26 Aug 2021 07:41:41 +0000
<
Вернуться на верх