question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Templates not being accessed?

See original GitHub issue

I’m using this library but when I see the email preview, it only it shows “from”, “to”, “messageid” and “date”. It doesn’t have a subject and body like your preview example. It also doesn’t send when I change the send property to true.

I think the template isn’t being acquired properly so I did a ‘console.log(email.getTemplatePath());’ but it shows ‘TypeError: Path must be a string. Received undefined’. I’m not sure why thats happening as my structure is:

.
├── helpers
  ├── email.js
  └── emails
    └── signup_consumer
        ├── html.pug
        └── subject.pug

my code is:

const email = new Email({
    message: {
        from: 'email@mail.com' 
    },
    send: true,
    transport: {
        jsonTransport: true
    }
});
    email
        .send({
            template: 'signup_consumer',
            message: {
                to: user.email
            },
            locals: {
                name: 'exampleuser',
                sitelink: 'example.com',
            }
        })
        .then(console.log)
        .catch(console.error);
    //console.log(email.getTemplatePath());

Issue Analytics

  • State:closed
  • Created 6 years ago
  • Comments:32

github_iconTop GitHub Comments

2reactions
Yakitrakcommented, Mar 13, 2018

It was looking for the path on ‘root/emails’ instead of in ‘root/helpers/emails’. I changed the path manually on email.config.views.root:

const email = new Email({
    message: {
        from: 'example@example.com'
    },
    views: {
        root: path.join(__dirname, 'emails')
    },
}

My mistake, I thought it would look from current directory not from root. Feel free to remove this issue.

0reactions
ibccommented, May 22, 2018

Thanks a lot.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Access 365 Templates cannot be opened - Microsoft Community
Hi Mike, I'm an independent adviser and will try to help. Based on the error message, it would appear that somehow the template...
Read more >
Troubleshooting guide for Shared Email Templates for Outlook
This guide presents possible solutions to problems you might encounter when installing, running, or using the Shared Email Templates for Outlook add-in.
Read more >
Error resolving template "index", template might not exist or ...
I fixed it but I am still getting the same error. The index.html file is currently in the templates directory. – Mike3355. Aug...
Read more >
System Administrator can't access Email Templates
It appears that '"Enable Classic email templates and related features" is not enabled in the org. You can do to resolve by using...
Read more >
Customize Email Templates - Auth0
Auth0 does not support plaintext/text-based emails. ... The attributes available for the user object will depend on the type of connection being used....
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found