Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix Dynamic smtp config require server restart to reflect changes #3282

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

Ankish76
Copy link

Description

Fixes the issue

When using dynamic SMTP config per channel, if SMTP config is changed from admin portal.
Nodemailer was not using updated config.
Had to restart the server to reflect the changes.

Copy link

vercel bot commented Dec 19, 2024

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Updated (UTC)
docs ✅ Ready (Inspect) Visit Preview Dec 19, 2024 0:44am

Copy link
Contributor

github-actions bot commented Dec 19, 2024

All contributors have signed the CLA ✍️ ✅
Posted by the CLA Assistant Lite bot.

@Ankish76
Copy link
Author

I have read the CLA Document and I hereby sign the CLA

github-actions bot added a commit that referenced this pull request Dec 20, 2024
@@ -76,22 +76,29 @@ export class NodemailerEmailSender implements EmailSender {
}

private getSmtpTransport(options: SMTPTransportOptions) {
if (!this._smtpTransport) {
if (!this._smtpTransport ||
JSON.stringify(this._smtpTransport?.options) !== JSON.stringify(options)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I believe there is a theoretical risk here with calling JSON.stringify on the options object could throw an error if there is a circular data structure in the object. I'm not sure but the options object can potentially include some complex structures like connection and socket and tls.

So it would be safer to extract a function for comparing these stringified objects which wraps the stringification in a try-catch block.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants