forwardemail / email-templates

Create, preview (browser/iOS Simulator), and send custom email templates for Node.js. Made for @forwardemail, @ladjs, @cabinjs, @spamscanner, and @breejs.
https://forwardemail.net/docs/send-emails-with-node-js-javascript
MIT License
3.67k stars 337 forks source link

Config Files #245

Closed gbourne1 closed 7 years ago

gbourne1 commented 7 years ago

It seems that not all the config parameters sent to the constructor are merged.

For example:

const mailOptions = {
    transport: emailer.getTransport(),
    message: {
        from: 'me@email.com',
    },
    juiceResources: {
        webResources: {
            images: false
        }
    }
};

The webResources for Juice with image as false will not be merged and used.

niftylettuce commented 7 years ago

@gbourne1 nice catch!!! will fix.

gbourne1 commented 7 years ago

Cool - I was try to solve it, but didn't find a straightforward solution. Basically want to do a deep merge, but because of circular references, I get stack overflows.

niftylettuce commented 7 years ago

@gbourne1 Hmm I'm actually unable to reproduce this. I wrote a test case and it worked.

See this commit https://github.com/niftylettuce/email-templates/commit/18a0c5c49a962a30cb0a8789209c27e0a4d31891.

Can you write a test case that fails and share it here?

niftylettuce commented 7 years ago

@gbourne1 would love for you to help here if you can - if you can provide me with an example or test case that fails I'll definitely fixed it - a bit confused how you're using it.