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

TypeError: EmailObject is not a constructor #26

Closed
haihuynhngoc opened this issue Dec 7, 2021 · 2 comments
Closed

TypeError: EmailObject is not a constructor #26

haihuynhngoc opened this issue Dec 7, 2021 · 2 comments

Comments

@haihuynhngoc
Copy link

haihuynhngoc commented Dec 7, 2021

I followed this tutorial to test mailersend-nodejs but there is an error message

const Recipient = require("mailersend").Recipient;
const EmailParams = require("mailersend").EmailParams;
const MailerSend = require("mailersend");

const mailersend = new MailerSend({
    api_key: "key",
});

const recipients = [
  new Recipient("your@client.com", "Your Client")
];

const emailParams = new EmailParams()
      .setFrom("your@domain.com")
      .setFromName("Your Name")
      .setRecipients(recipients)
      .setSubject("Subject")
      .setHtml("This is the HTML content")
      .setText("This is the text content");

mailersend.send(emailParams);
./node_modules/mailersend/src/modules/email.js:5
    let emailObject = new EmailObject(emailParams)
                      ^

TypeError: EmailObject is not a constructor
    at MailerSend.send (./node_modules/mailersend/src/modules/email.js:5:23)
    at Object.<anonymous> (./index.js:33:12)
@haihuynhngoc haihuynhngoc changed the title EmailObject is not a constructor TypeError: EmailObject is not a constructor Dec 7, 2021
@emmanuelvlad
Copy link

Versions 1.2.0 and above are broken because of this

@me-shaon
Copy link
Contributor

me-shaon commented Dec 7, 2021

@haihninit thanks for reporting the issue and providing the fix. The PR is merged and new version 1.3.1 is released with this patch.

@me-shaon me-shaon closed this as completed Dec 7, 2021
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

3 participants