1

I am trying to send mail using phpmailer, so my function which is returning body of mail,is like :

function get_include_contents(){
// some code
 include "graph.php"
  //some code<br/>
}

"graph.php" file is actally generating a table and graph (i am using highchart.js) ,

when I run my file to send mail , I am getting table only (which is generated in php). I am not getting graph(which is geneated in by javascript).

How should I display graph in mail ?

iLaYa ツ
  • 3,941
  • 3
  • 32
  • 48

1 Answers1

0

Imho you're best shot is to make a pdf out of the graph.php page and use that pdf as an attachment in your email. This process has been discussed here Print a webpage to pdf document using php

Community
  • 1
  • 1
Roebie
  • 488
  • 2
  • 6
  • Thanks your input , but for client ,they have to download the pdf to see the results !!!! – saurabhhack123 Jul 19 '13 at 07:16
  • Depends on his email client. Some show a preview of attachments in the message. – Roebie Jul 19 '13 at 07:27
  • You could also just add a link to the php page in the email. – Roebie Jul 19 '13 at 07:28
  • Putting javascript in the email is just not an option for so many reasons. Putting the generated html in there is probably not an option either as most email clients only accept a really restricted set of html and you'll have major trouble getting the email client to show want you want. Getting it cross email client is even more difficult since each one renders html differently. Web clients tend to be even worse. – Roebie Jul 19 '13 at 07:30
  • The main problem is that you want dynamic data in a medium (email) that was designed for static data. That's just asking for trouble. – Roebie Jul 19 '13 at 07:35
  • Thanks man , Finally I switched to libchart php library .It's working fine . – saurabhhack123 Jul 19 '13 at 09:23