/// utils.py ///
C:\Users\Yanga\Desktop\GAAS\accounts\views.py
, line 58, in registerUser-
user = User.objects.create_user(first_name=first_name, last_name=last_name, username=username, email=email, password=password)
-
user.role = User.CUSTOMER
-
user.save()
-
-
#Send verification email
-
mail_subject = 'Please activate your account'
-
email_template = 'accounts/emails/account_verification_email.html'
-
send_verification_email(request, user) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
…
-
messages.success(request, "Your account has been registered successfully!")
-
return redirect('registerUser')
-
else:
-
print('invalid form')
-
print(form.errors)
-
else:
C:\Users\Yanga\Desktop\GAAS\accounts\utils.py
, line 32, in send_verification_email
-
'user': user,
-
'domain': current_site,
-
'uid': urlsafe_base64_encode(force_bytes(user.pk)),
-
'token': default_token_generator.make_token(user),
-
})
-
to_email = user.email
-
mail = EmailMessage(mail_subject, message, to=[to_email])
-
mail.send()
Hi Ibrahim Salami ,
The issue you are facing occurs when your SMTP configuration is incorrect. Please check your SMTP settings to ensure they are correct. Additionally, the GitHub repository link you provided is incorrect.
If you are unable to fix the issue, please provide a screenshot of your SMTP configuration and share a ZIP file link to your project so we can assist you in resolving the problem.
@mohaiminul-islam Thanking you so much. This has been resolved. I want to believe the issue is from gmail.
An invitation has been sent to you as collaborator on the repository.
Thanks
I am having an error with respect to the email verification set up
Samuel Bakare , The issue you are facing is due to an incorrect SMTP configuration. Please fix it. Your SMTP configuration should look like this:
- EMAIL_HOST=smtp.gmail.com
- EMAIL_PORT=587
- EMAIL_HOST_USER=your_email@gmail.com
- EMAIL_HOST_PASSWORD=your_email_app_password
- EMAIL_USE_TLS=True
- DEFAULT_FROM_EMAIL=foodOnline Marketplace <foodonline576@gmail.com>
Here are the steps to generate a Google App Password:
1. Go to your Gmail account.
2. In the top right, press a circular icon with your first name's letter on it or your profile image.
3. Below the salutation, you will see "Manage your Google Account".
4. Choose it.
5. In the new window (in the top left) you will see the category called "Security".
6. Press it.
7. Just in the center (scroll a bit down), you will see a table called "How you sign in to Google". Click 2-step verification and follow the instructions there.
8. After following the instructions (when you have set the verification), press the "2-step verification" forward arrow again (if you did it right, there will be a green tick).
9. Enter your password.
10. You will be redirected to a new page where you need to scroll down, give a name to your app, press "Generate App Password" and copy it into your .env file.
11. By the way, EMAIL_HOST_USER=foodonline@gmail.com(or any other email) must be WITHOUT ''django'.
12. Your EMAIL_HOST_PASSWORD must be WITHOUT spaces and commas.
Your email configuration could look similar to this:
# Email configuration
EMAIL_HOST=smtp.gmail.com
EMAIL_PORT=587
EMAIL_HOST_USER=foodonline@gmail.com
EMAIL_HOST_PASSWORD=cdtkgthwnapzlcgy
If you face any issues or experience any inconvenience, please let us know — we’re here to help you.