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

My template is not loaded? #1081

Open
vladimirteddy opened this issue Jan 1, 2024 · 5 comments
Open

My template is not loaded? #1081

vladimirteddy opened this issue Jan 1, 2024 · 5 comments

Comments

@vladimirteddy
Copy link

My config in app.module.ts:
MailerModule.forRoot({ transport: { host: 'smtp.gmail.com', port: 587, ignoreTLS: false, secure: false, auth: { user: process.env.GMAIL_USER, pass: process.env.GMAIL_PASS, }, }, defaults: { from: '"No Reply" <info@xxxxxxx>', }, // preview: true, template: { dir: process.cwd() + '/src/templates/', adapter: new HandlebarsAdapter(), options: { strict: true, }, }, }),

My config in sendMail:
const sendMail = await this._mailerService.sendMail({ to: user.email, subject: "Confirm Your Email Address", context: { name: 'my name' }, template: 'my-template', });

My mail account receives mail but there is no template.
"@nestjs-modules/mailer": "^1.6.0"
"nodemailer": "^6.7.0"

@amitailanciano
Copy link
Contributor

amitailanciano commented Jan 3, 2024

I had the same issue, turns out it was due to the css-inline dependency throwing an error because of Google fonts in my template. The error is currently ignored in an empty try/catch block in the handlebars adapter, it should probably call the callback function and pass the error in the catch block instead.

you can work around it by disabling inline css in the second argument of the handlebar adapter instantiation.

see Stranger6667/css-inline#264

@vladimirteddy
Copy link
Author

Thanks for your suggest. I fixed it by loading the template manually.

@Simolation
Copy link

I also have this issue that the email is just empty without any exception or anything, and it used to work flawlessly before the 1.10 update.
Disabling the inline css { inlineCssEnabled: false } fixed the problem for me.

@LeCongNam
Copy link

Thank you @amitailanciano { inlineCssEnabled: false } work with me.

@Stranger6667
Copy link
Contributor

FYI, the WASM version of css-inline will get support for fetching external resources over the network, as soon as Stranger6667/css-inline#320 is done (it will use fetch internally)

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

5 participants