We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 52730
    • 9 Posts
    Hi,

    You know how to send an email, after compiling a form (such as FormIt), with attach a pdf version of the email.

    You know if there's some plugin to do that?

    All ideas are welcome.

    Thank's to all in advance,
    regards,
    Davide
      • 22840
      • 1,572 Posts
        • 52730
        • 9 Posts
        Thank you, but this solution is for attach a file.

        My question (sorry my english is poor) is:

        After I had compiled the form, before the mail is sent, I want create automatically a PDF version of the message and send it like attachment.

        Thank's,

        regards,

        Davide
          • 40706
          • 128 Posts
          Look this: https://forums.modx.com/thread/100490/formit-send-form-data-as-attachment#dis-post-543066

          Just create an PDF instead of an csv file.
          For an mostly simple Solution I would recommend to take mpdf for best HTML / CSS Support and use an HTML Chunk as Content.
            • 52730
            • 9 Posts
            Thank's a lot!

            This is a great way laugh

            Regards,

            Davide
              • 52730
              • 9 Posts
              Quote from: m.engel at Sep 13, 2016, 07:49 AM
              Look this: https://forums.modx.com/thread/100490/formit-send-form-data-as-attachment#dis-post-543066

              Just create an PDF instead of an csv file.
              For an mostly simple Solution I would recommend to take mpdf for best HTML / CSS Support and use an HTML Chunk as Content.

              Hi,

              I've tried this solution and the hook creates correctly the file (I tried with the code above for test).

              But I've some issues with FormIt because with my "custom hook" the form doesn't redirect to the landing page
              and the file is not attached to the mail.

              You know something about these issues?

              Thank's so much and regards, Davide

                • 40706
                • 128 Posts
                Maybe you missed "return true;" at the end.
                https://rtfm.modx.com/extras/revo/formit/formit.tutorials-and-examples/formit.examples.custom-hook#FormIt.Examples.CustomHook-customhookSnippet

                Also all hooks are executed in the sequence as they are listed. So your hook has to be in front of email, redirect has to be the last.
                  • 52730
                  • 9 Posts
                  Hi,
                  thank's a lot to all!

                  I've created the files with my custom Hook.

                  All works good but I think there are some issues with the FormIt mail attachments
                  because with and without my custom hook the attachment is not send.

                  Passing the POST array for test, the file value attached isn't send in the POST array.

                  I don't know if I miss something in my code because I can't find documentation about FormIt mail attachments.

                  This is how I've implemented that:

                  FORMIT
                  [[!FormIt?
                  				   &hooks=`spam,attachPdf,email,FormItAutoResponder,redirect`
                  				   &emailTpl=`EmailTemplate`
                  				   &emailTo=`[email protected]`
                  				   &redirectTo=`1`
                  
                  				   &fiarTpl =`EmailTemplate`
                  	   			   &fiarSubject =`Sending confirmation email`
                  	   			   &fiarToField=`email`
                  	   			   &fiarFrom=`[email protected]`
                  	   			   &fiarFromName=`Name`
                  	   			   &fiarReplyTo=`email`
                  ]]
                  


                  FORM TAG
                  <form id="formPrivate" action="[[~[[*id]]]]" method="post" enctype="multipart/form-data"> 
                  <!--  field list --> 
                  
                  <!--  input FILE --> 
                  <input id="attachment" name="attachment" type="file" value="[[+fi.attachment]]" />  
                  
                  <!--  field list and submit --> 
                  
                  </form>
                  


                  EMAIL TEMPLATE (I tried to insert the value of field)
                  <strong>Name:</strong> [[+name]]
                  <!-- Field List -->
                  
                  <!-- Field input File -->
                  [[+attachment]]	
                  


                  Thank's a lot another time,

                  your help is very precious,

                  regards,

                  Davide [ed. note: dido_modx last edited this post 10 years, 1 month ago.]