Fixed email service error during send email #760
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This pull request includes several changes to improve email handling and logging in the
src/Services
directory. The most important changes include removing unnecessary exceptions, improving logging messages, and fixing a typo in variable names.Email Handling Improvements:
src/Services/Helpers/EmailHelper.cs
: Removed the exception thrown when thetoReceipents
string is empty, allowing the function to proceed without interruption.src/Services/Helpers/EmailHelper.cs
: Modified fallback values forSSL
andPort
settings to prevent exceptions and ensure default values are used if configuration values are invalid.Logging Enhancements:
src/Services/Services/SMTPEmailService.cs
: Improved the logging messages for SMTP and general exceptions to provide clearer information. Also added a log entry for cases where the email is not sent due to an empty "To" email address.Typo Fixes:
src/Services/StatusHandlers/NotificationStatusHandler.cs
: Corrected the typo in the variable name fromuserdeatils
touserdetails
.src/Services/StatusHandlers/NotificationStatusHandler.cs
: Simplified the logic to send emails by removing redundant checks for empty email addresses.Removed manual exception throwing when To email are empty Handled both in SMTPemailservice.