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

sendEmail hangs indefinitely after migrating 1.8.1 to 1.9.1+ #1216

Open
radulescuandrew opened this issue Jul 9, 2024 · 1 comment
Open

Comments

@radulescuandrew
Copy link

radulescuandrew commented Jul 9, 2024

Describe the bug
After bumping from version 1.8.1 to 1.9.1, the emails are stuck in sendMail on local but works in a staging environment.

To Reproduce
Steps to reproduce the behavior:

  1. Bump from 1.8.1 to 1.9.1
  2. Send any email

Expected behavior
The email is sent.

Versions:

  • OS: MacOS 14.4.1
  • Node: 20.11.0
  • NPM: 10.2.4
  • Mailcatcher 0.9.0 but also tried with remote SMTP

Additional context

The config stays the same as on 1.8.1, nothing changed.

createMailerOptions(): MailerOptions {
    return {
      transport: {
        host: this.configService.get('MAIL_HOST'),
        port: +this.configService.get('MAIL_PORT'),
        ignoreTLS: false, 
        secure: false, 
        auth: {
          user: this.configService.get('MAIL_USER'),
          pass: this.configService.get('MAIL_PASS'),
        },
      },
      defaults: {
        from: '"No Reply" <no-reply@localhost>',
      },
      preview: true,
      template: {
        dir: __dirname + '/../../mail/templates',
        adapter: new HandlebarsAdapter({ asset_url: this.createAssetUrl }),
        options: {
          strict: true,
        },
      },
      options: {
        partials: {
          dir: __dirname + '/../../mail/templates/' + 'partials',
          options: {
            strict: true,
          },
        },
      },
    };
  }

✅ The email is sent if the template is removed
❌ otherwise the following function never errors out or return: this.mailerService.sendMail(mailOptions);

There is any major change between 1.8.1 and 1.9.1 which I'm missing?

Later edit:

With debug: true is shows the following:

[2024-07-09 13:33:19] DEBUG Sending mail using SMTP/6.7.5[client:6.7.5]
[2024-07-09 13:33:19] DEBUG Using 1 plugins for compile
[2024-07-09 13:33:19] DEBUG Using 1 plugins for stream

Much appreciated!

@radulescuandrew
Copy link
Author

Removing preview: true fixed my issue.

On version 1.8.1 it was working just fine with the preview active.

Close the issue if you consider it a non issue or you can't reproduce. Thanks!

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

No branches or pull requests

1 participant