Send document from Lectora to email

heidi Community Member Posts: 72 ♪ Opening Act ♪

our course has multiple entry fields throughout where the user can type in their answers, which we later display on a printable page at the end course. The page is set up so user can click Print and the document will print as a takeaway. On the Print Dialogue box, the user could also select "save as a PDF" if they have that ability on their own computer. (I assume we cannot create save as a PDF option within Lectora.) So, the Client would like the option to email this document to the user, or perhaps to a manager. Does anyone know if this is possible? Thanks, Heidi


  • ccalahan5405
    ccalahan5405 Community Member Posts: 10 ☆ Roadie ☆
    Are you trying to print a certificate?

    Otherwise, IF they print to PDF,  the actual PDF creation is handled outside of Lectora. It will ask them to save the PDF file, which they could then locate and email, or save to a shared file location. I don't think you can email it from there. Or you can create a certificate using KnowledgeLink (our LMS) - not sure if you use that but it's a great product.
  • ccalahan5405
    ccalahan5405 Community Member Posts: 10 ☆ Roadie ☆
    Hi Heidi,


    I got some help from my teammates:


    Lectora does have the certificate tool which creates a page with desired student details presented.  The user can perform the same print or save as pdf to retain the certificate. There is just no way to automatically attach this doc to an email and send it from the user's system.

    I think you would be able to append a 'emailmanagervariable' with the information and auto add that to the body of a mailto javascript function.


  • carlfink
    carlfink Community Member Posts: 1,102 ✭ Legend ✭
    It looks as if you can send email if you are using xAPI:

    I haven't tried this, and can't. We don't use xAPI at my company.
  • mnotermans5114
    mnotermans5114 Community Member Posts: 916 ☆ Roadie ☆
    As i have a pure Javascript solution for sending email it is possible to add files to it.
    Let me check my code...

    Using SMTPJS script to mail directly without a users email-client..
    var studentNaam = VarstudentNaam.getValue();
    var mailAdress = VarmailAdress2.getValue()
    sendEmail(mailAdress,studentNaam,"my subject","my email text");


    function sendEmail(_to,_from,_subject,_body){
    Host : "",
    Username : "************",
    Password : "***********",
    To : _to,
    From : "from [email protected]",
    Subject : _subject+" van: "+_from,
    Body : _body
    function(value) {
    console.log(value);$(".response", getDisplayDocument()), 0.5, {autoAlpha:1})


    So basically you can add any file here...

  • carlfink
    carlfink Community Member Posts: 1,102 ✭ Legend ✭
    Math, doesn't that require you to put a valid SMTP password in the JavaScript in cleartext? So anyone looking at the page's code could use your SMTP credentials to spam in your name?
  • heidi
    heidi Community Member Posts: 72 ♪ Opening Act ♪
    Thanks for the offers to help, I appreciate the code also Math!

    BTW, this does not have anything to do with a Certificate and the client does not have an LRS and we cannot use a google doc, so the xAPI will not help.

    I convinced the client to accept the option Print to PDF (which most users have nowadays), but I wish there was an easy want to send info from Lectora via email.