How to send whole table by email ?

How to send whole table by email ?

shamanvirtuelshamanvirtuel Posts: 1Questions: 0Answers: 0
edited February 2011 in General
hello,

Thanks for this great plugin !

I'm dev'ing an intranet application using datatables, and i need to know if there's a way to send the whole table by email.

I saw the datatools PDF function , but what i need is to build the pdf and then attach it to an email .
is it possible ?

if not, any hint in order to achieve this goal ?

Thanks a lot by advance
shaman

PS: forgive my English, I'm french.

Replies

  • big-dealbig-deal Posts: 38Questions: 0Answers: 0
    Hey.

    I am not sure in what language you are coding, but I will guess php.

    You can simply create a pdf and attach it to a mail.
    In php you can send a mail and attachmants.
    Just have a look how the pdf is rendered - save it, and go to a php file to send a mail with attachments.

    Good luck!

    big-deal
  • allanallan Posts: 63,516Questions: 1Answers: 10,472 Site admin
    There is a little complication here - the PDF that TableTools creates is done on the client-side, what big-deal suggests requires some server-side processing (which is typically where an e-mail will be sent from since there is (usually) and SMTP mailing daemon available). I say typically because it is possible to use mailto: can a desktop app, but I don't believe it is possible to attach a generated file automatically...

    I would suggest that if you want to e-mail a PDF as an attachment, you'll need to look at generated a PDF on the server-side and e-mailing it out from there.

    Allan
  • big-dealbig-deal Posts: 38Questions: 0Answers: 0
    edited March 2011
    Hey Allan.

    The pdf is done in the client side - but I believe you can do a javascript function that will do the required things to make the pdf and then will do an ajax call or something do send it...
    Just like uploading the file to the server (using ajax) - and then mailing in using the built in php function.
    I believe that something of that sort can be accomplished.... but I haven't tryed it myself yet...

    big-deal
  • allanallan Posts: 63,516Questions: 1Answers: 10,472 Site admin
    I doubt that can be done in Javascript itself, since it has no access to the local file system (unless of course you are using some of the new HTML5 properties). Having said that, what you describe could most certainly be done in Flash - at the moment the PDF that is generated is saved to the local file system - there is no reason why it couldn't be sent to the server using a Flash remote request or a socket. Then the e-mail could be sent off as you say - which is a fairly cool idea :-)

    Allan
This discussion has been closed.