Skip to content

Feature/mandrill template - #1517

Closed
aleho70 wants to merge 3 commits into
strongloop:masterfrom
aleho70:feature/mandrill-template
Closed

aleho70 wants to merge 3 commits into
strongloop:masterfrom
aleho70:feature/mandrill-template

Conversation

@aleho70

@aleho70 aleho70 commented Jul 10, 2015

Copy link
Copy Markdown

Support for sending user verify emails with templates also via lb-connector-mandrill to Mandrill API.
It allows to use local EJS templates or remote Mandrill templates.

  • If template attribute is string, then is expected that it is file name of local EJS template.
  • If template is object with name attribute then is expected that email transport connector is converting template to html itselfs, so in case of lb-connector-mandrill it could be for example Handlebars Mandril template.
    • NOTE: All atribute names in options in camelCase format will be converted to lowercase format, i.e. options.verifyHref to options.verifyhref

@slnode

slnode commented Jul 10, 2015

Copy link
Copy Markdown

Can one of the admins verify this patch? To accept patch and trigger a build add comment ".ok\W+to\W+test."

@teone

teone commented Jul 15, 2015

Copy link
Copy Markdown

Hi @aleho70
I'm facing this issue right now.. Any suggestion on how to use a custom .ejs template without this patch?

I was trying something like

let options = {
    type: 'email',
    port: '80',
    to: ac.email,
    from: app.get('emailFrom'),
    subject: 'Thanks for registering.',
    verifyHref: verifyHref,
    template: null,
    user: ac
};

var template = loopback.template(path.resolve(__dirname, '../../server/views/verify.ejs'));
options.html = template(options);

But it seems that loopback set a default template if none is specified and then lb-mandrill-connector trhows Uncaught AssertionError: template name should be defined

Thanks in advance for any help

@bajtos

bajtos commented Aug 6, 2015

Copy link
Copy Markdown
Member

@slnode ok to test

@bajtos

bajtos commented Aug 6, 2015

Copy link
Copy Markdown
Member

@aleho70 thank you for the pull request. Could you please add a unit-test to verify the implementation?

@raymondfeng @ritch you are more familiar with this part of loopback than I am, could one of you please review & land this patch?

@brainwatch

Copy link
Copy Markdown

Hi

I'm stuck with the same problem of Mandrill with loopback. Any update on this ?

Thanks

@bajtos

bajtos commented Aug 31, 2015

Copy link
Copy Markdown
Member

@ritch you seem to be the author of this part, could you please review?

@bajtos

bajtos commented Dec 8, 2016

Copy link
Copy Markdown
Member

Hello! We have implemented a different solution in #2937, where users can provide a custom templateFn function that can use a custom templating engine to render the HTML body (for example). Also since #3004, we are removing options.template after options.html was constructed, in order to prevent Email transport errors.

IIUC, lb-mandrill-connector allows users to perform template->html conversion by the server sending emails (Mandrill in this case). I understand how this use-case can be useful. If there is a volunteer willing to rework the patch proposed in this pull request on top of the latest master, and include unit-tests to cover this new feature, then please open a new pull request.

I am closing this one as it's too outdated.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

8 participants