lookback / meteor-emails

Improved Meteor emails with templating, previews and automated CSS/SCSS inlining.

Home Page:https://atmospherejs.com/lookback/emails

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Feature request: example of sending attachments/clearer documentation of attachments param please

adamgins opened this issue · comments

Thanks again for the awesome package.

Any chance you have an example of sending attachments... About to start working it out.. just looked like your doc said an object but mailcomposer took and array of objects, so was not sure of the format.

My example, trying to send an iCal/ics as an attachment

any help appreciated

Hi @adamgins. This was added in PR #60, and the code says "array of objects", but the README says object. I missed that, sorry. Does it work with arrays of objects?

Fixed in cb01259.

@johanbrook thanks heaps for the quick response.
how do make the attachments show up??? is there an example pls

I tried:

var result = Mailer.send({
                    to:  email,           // 'To: ' address. Required.
                    subject: "Some subject",
                    template: "<template name>",               // Required.
                    replyTo: '<email addres>',       // Override global 'ReplyTo: ' option.
                    from: "Do Not Reply" + "<donotreply@buzzy.buzz>",         // Override global 'From: ' option.
                    data:{},
                    attachments: [{   // binary buffer as an attachment
                        filename: 'text2.txt',
                        content: new Buffer('hello world!','utf-8')
                    }]
                });

I get the email but does not seem to have the attachment

Any ideas, pls?

Any errors? Try cloning down the package into your local packages folder and add some console logs to see that the attachments property really is what it is.

can't seem to see anything on the server console.

on the client I see

Exception while simulating the effect of invoking 'microAppEmailCalendar' ReferenceError: Mailer is not defined(…) ReferenceError: Mailer is not defined
    at microAppEmailCalendar (http://localhost:3000/packages/buzzy-buzz_resources-core.js?hash=f03a9066c3fb909b4683239cd90496a2ecf9ddc1:1101:34)
    at http://localhost:3000/packages/ddp-client.js?hash=b5f1b97df6634673c68f37914ae9f4c3231c438e:3957:25

But I still get the email. That error line 1101 must be in generated Meteor code as it's for code that does not even run in my source file.

Hm, seems like Mailer is called on the client somewhere, in a method.

But as I said: the attachments is just sent to Meteor's Email.send(). Try popping into meteor shell and call Email.send() programmatically, with the necessary options.

ok, will check thanks
I think that error may have been that I did not wrap the method in Meteor. isServer