Create an attachment and send it with email


#1

Hi there!
I want my app to create some file which will contain some data from opened page. I see that I can export data for example in CSV, but I don’t want to do that (not download, just only “store” and send that). I really want to do is:

  1. Click the button: Send an email
  2. That email should have a message (text) and attachement which will have the data from the page when my button was clicked (I have something like invoices tables).

I’ve done sending an email with “email” package, but I can’t send an attachment with that package. I saw “sendgrid” package which allow me to send an attachment but… can I send a created file there? If I can how to do that?

If somebody has better option here, please let me know :smile:
Thanks!


#2

If you can wait for 1.2 (or use meteor --release METEOR@1.2-rc.12), you’ll get this with the email package: https://github.com/meteor/meteor/blob/devel/History.md#email


#3

I think I can wait, but what about creating a file with the “page data” and sending that file as attachment?


#4

There are a number of threads on the forum which cover PDF generation from the HTML. Not a huge leap to take that and attach it to an email.


#5

I’m really new to ll that Meteor thing, sorry :smile:
I thought PDF generator here are not working well.

Should I save that PDF and then use it as attachment? Or save that pdf to variable?


#6

Sorry: I wasn’t being dismissive, I was just offering that as a potential way to move forward :smile:.

I would imagine it’s possible to save a PDF in a base-64 string, which would make it feasible to generate on the client directly from the page. However, I have not done this, so I may be completely off base :wink:.


#7

Understood :wink:
I’ll try to do something, maybe I’m gonna done it correctly.

So I’m gonna wait till update :smiley: