adilmohak / django-lms

A learning management system using django web framework. Course add and drop, grade and assessment result management, online quiz, report generator, student and lecturers management, dashboard, and so much more...
MIT License
584 stars 251 forks source link

Lack of Error Handling in Project's Email SMTP Configuration #30

Closed WajahatKanju closed 5 months ago

WajahatKanju commented 8 months ago

The current implementation of the email sending functionality in the Django project does not effectively handle errors related to SMTP configuration. Specifically, when an incorrect email SMTP server is entered, the system freezes without providing any error message. This behavior persists regardless of whether the SMTP password is correct or incorrect.

Steps to reproduce the behavior:

  1. Setup the Django project.
  2. Install project dependencies using pip install -r requirements.txt.
  3. Create a superuser using python manage.py createsuperuser.
  4. Trigger an action that sends an email, such as a staff user creating a new entry.
  5. Observe the system behavior and lack of error handling when SMTP configuration errors occur during email transmission.

Expected behavior I expected the system to handle SMTP configuration errors during email transmission appropriately. Specifically, when encountering an incorrect SMTP configuration, I expected the system to provide informative error messages or notifications, allowing for easier diagnosis and troubleshooting of the issue. Additionally, I anticipated that the system would not freeze but gracefully handle such errors, ensuring the continued functionality of the application.

Error Handling Implementation

Introduce error handling mechanisms within the email sending functionality to appropriately capture and manage SMTP configuration errors.

Exception Handling

Implement exception handling routines to catch potential errors that may arise during the process of sending emails, such as smtplib.SMTPException or smtplib.SMTPAuthenticationError.

Logging Incorporate logging features to record any encountered errors or exceptions during email transmission. This logging functionality will facilitate troubleshooting and debugging efforts.

User Feedback Ensure that users receive informative feedback when SMTP configuration errors occur during email transmission. This feedback can be conveyed through user interface notifications or system-generated messages.

Testing Conduct comprehensive testing of the email sending functionality across various scenarios, including instances where the SMTP configuration is incorrect. This testing will validate the robustness and reliability of the email transmission process.

adilmohak commented 6 months ago

Hey @WajahatKanju,

The email sending functionality is now handled by celery tasks, so we can do things like

WajahatKanju commented 6 months ago

Sounds good, @adilmohak ! I'll take a thorough look into it to ensure everything is working as intended. Once confirmed, we can mark the issue as closed.

adilmohak commented 6 months ago

Great :)

WajahatKanju commented 5 months ago

Good Job.