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

Use template for both text and html #13

Closed
dagatsoin opened this issue Feb 12, 2021 · 2 comments
Closed

Use template for both text and html #13

dagatsoin opened this issue Feb 12, 2021 · 2 comments

Comments

@dagatsoin
Copy link

dagatsoin commented Feb 12, 2021

Hi,
thanks you for this module, it is very helpful.

Context:
I have an issue with my spam score which I can fix by sending both HTML and text version of the email.

** The issue:**
I have to "hardcode" the text version because the template field acts only for the HTML version.

this.mailerService.sendMail({
      from: `"Nekroz - Goblins Market" <${process.env.MAIL_USER ?? ""}>`,
      to: user.email, // list of receivers
      subject: "Goblins Market : bienvenue !", // Subject line
      template: "welcome", // The `.pug`, `.ejs` or `.hbs` extension is appended automatically.
      text: ejs.render(`Hello <%= locals.username %>. ...`,  { username: user.username }), // Template content duplication here
      context: {
        username: user.username,
      },
    });

Do you know a workaround for this ? I can help you with a PR if you provide me some guidelines to respect your module architecture.

@yanarp
Copy link
Owner

yanarp commented Feb 12, 2021

Hey @dagatsoin ,

As per your usage you want to use single option for both HTML and plain text to send content from your client to receiver's, it's seems to be non-negotiable at this moment, as both of these options serves a separate requirements for receiver side email client, which ensures to have both plain text and template for it's usage,

check nodemailer documentation for reference - http://nodemailer.com/extras/mailcomposer/#alternatives

If you happen to have any solution feel free to open a PR with separate service file for this implementation 👍

Happy Hunting !

@dagatsoin
Copy link
Author

Thx for the hint. I will come back if necessary :)

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

2 participants