fix(email): resolve SMTP authentication failure and improve configuration resilience

- Fixed a bug where missing 'id=0' in the 'cfg' table caused SMTP authentication to fail by defaulting to placeholder credentials.
- Updated 'app/lib_email.py' to explicitly validate SMTP server and port settings before connecting, preventing crashes with 'please run connect() first'.
- Added email fallback logic in 'app/methods/person_methods.py' to use 'user_email' or 'primary_email' if the primary contact email is missing.
- Aligned 'app/config.py.default' with the production structure, explicitly re-adding 'SMTP' and 'FILES_PATH' dictionaries.
- Added comprehensive unit tests in 'tests/test_email_configuration.py' to verify configuration handling.
This commit is contained in:
Scott Idem
2026-01-15 13:19:58 -05:00
parent 34a752d455
commit f0711f27b4
6 changed files with 282 additions and 71 deletions

View File

@@ -1838,7 +1838,7 @@ def handle_email_person_auth_key_url(
from_name = account_cfg.default_no_reply_name
to_name = person_obj.full_name
to_email = person_obj.email
to_email = person_obj.email or person_obj.user_email or person_obj.primary_email
bcc_email = account_cfg.confirm_email
bcc_name = account_cfg.confirm_name