phpjavascripthtmlemaillimesurvey

Send contents of a dynamically-generated survey page over email


I have an installation of survey web app LimeSurvey set up for a coworker's project. It works great. I've customized the HTML, CSS (with a separate print stylesheet), and JavaScript to our liking.

I need the user to able to send the contents of a dynamically-generated page of questions (in our case actually "recommendations", but still "questions" to the system) either in the body of an email, or as an attachment. This content contains a number of divs with simple formatted (some bolding) text content. Preferably this email would use the print stylesheet I've defined, but really anything readable would do.

I would use an existing service like EcoSafe, but that service visits the given URL itself and converts it to a PDF. This means they get the front page of the survey rather than the dynamically-generated page content the user sees.

I've searched and found some talk of PHP libraries that can send formatted emails, but I have little-to-no PHP experience. I'm thinking maybe I can use JavaScript or JQuery to grab the contents of the page and then a server-side tool to send that content in an email...but I don't quite know where to start. I have full access to our web server and so can install any libraries or scripts necessary.

Or if there's even a way to do this with mailto: links, that could be sufficient.

Anybody have ideas on how to send the contents of a dynamically-generated page in an email?

Thanks in advance.


Solution

  • You can use included system from LimeSurvey.

    1. Construct some part of your body with Expression Manager: example :"Your answer to {QuestionCode.question} was {QuestionCode.NAOK}" in some equation question type (more easy to use it after)
    2. Use 'Send basic admin notification email to:' par to put the email adress : you can use EM too : for example {if(Q1.NAOK=='Y','yesadress@example.org','adress@example.org')} ...
    3. Use Email template/Basic admin notification to put all your needed content.

    Denis