No announcement yet.

Attach a generated PDF to an email automatically

  • Filter
  • Time
  • Show
Clear All
new posts

  • Attach a generated PDF to an email automatically

    I need to create PDF files that automatically should be emailed after generation. A logical way to do this is to add the php code to email the file in an event occuring after the PDF has been generated to a server folder, in the pdf report itself but unfortunately there is no such event.

    Anybody who have a good solution to this?
    HelTech Communication

  • #2
    Re: Attach a generated PDF to an email automatically

    I suggest you use fpdf command and libraries to create your pdf file through scriptcase Blank Application, but first you need to load the fpdf.php from C:NetMakev6wwwrootscriptcaseprod hirdfpdf to your scriptcase development libraries.

    To save it to a folder on the server use:


    After that, you can use the following scriptcase function to send the pdf attachment via email.

    sc_mail_send (SMTP, Usr, Pw, From, To, Subject, Message, Mens_Type, Copies, Copies_Type, Port, Connection_Type, Attachment)

    If you are using the ReportPDF application from scriptcase, then you can use sc_pdf_output() macro to save the file.


    • #3
      Hi Leatheric,
      I did a ReportPDF and I used sc_pdf_output([path].'/'.[file_name].'.pdf',"F"); within Code section.
      It seems that it works but I would like inhibit the viewing of the default form that asks for saving or open the pdf.
      I want only to generate the pdf and attach it to an automatic e-mail sending.

      How can jump that step and save only the pdf file generated somewhere ?


      • #4
        How could we print a simple pdf in background and attach it to a simple eMail to the customer? Sometimes with you can reach difficult staff with a couple of clicks and a really simple task in various wasting time days to solve on Scriptcase :-(