9 Replies Latest reply on Sep 28, 2015 10:57 AM by FrankB@FDA

    Email script

    ashr1971

      Just a simple javascript to send a form via email,thats all I need ,lol

        • 1. Re: Email script
          Mandy_Wiesener Level 3

          You could use the following. You could use field entries, then you have to change the path and the objectname to yours.

           

          var Mailto = Formular1.s1.email.rawValue;

           

           

          You could use static text

           

          var Mailto = "test@test.de";

           

           

          It's your choice.

           

          //fill in e-mail
          var Mailto = Formular1.s1.email.rawValue;
          //var Mailto = "test@test.de";
          
          //fill in subject
          var Betreff = Formular1.s1.betreff.rawValue;
          //var Betreff = "Test-Betreff";
          
          //fill in message
          var Nachricht = "Content PDF:\r" + "Field content: " + Formular1.s1.inhalt.rawValue + "\rName: " 
          + Formular1.s1.name.rawValue + "\rDatum: " + Formular1.s1.datum.formattedValue;
          //var Nachricht = "This is a test message.\r2.row start here.\r3.row here.";
          
          //fill in e-mail cc
          var CC = Formular1.s1.emailcc.rawValue;
          //var CC = "testcc@test.de";
          
          //fill in e-mail bcc
          var BCC = Formular1.s1.emailbcc.rawValue;
          //var BCC = "testbcc@test.de";
          
          var Mail = "mailto:" + Mailto + "?Subject=" + Betreff + "&Body=" + Nachricht + "&cc=" + CC + "&bcc=" + BCC;
          
          //cSubmitAs: "PDF" send the pdf as attachment
          //cSubmitAs: "XML" send the pdf as xml-attachment
          event.target.submitForm({
          cURL: Mail,
          bEmpty: true,
          cSubmitAs: "XML"
          });
          

           

          I hope that will helps?

          Mandy

          • 2. Re: Email script
            Mandy_Wiesener Level 3

            You could also use the following:

             

            1. Take a submit-button.
            2. Fill in the emailadress.
            3. Fill in the subject.
            4. Select "submit as" XML or PDF.

            submit.jpg

             

            I hope one of the both will helpful?

            Kind regards Mandy

            • 3. Re: Email script
              ashr1971 Level 1

              Thank you for this.

               

              What does Nachricht and betreff mean?Also,how do I add a field from the form to the subject line?

               

              Thanks!!!

              • 4. Re: Email script
                Mandy_Wiesener Level 3

                Sorry. I come from Germany. This is the german word for message.

                 

                Nachricht = Message

                Betreff = Subject

                 

                I forgot to change this.

                But this is only a variable..

                 

                You can work with them?

                • 5. Re: Email script
                  ashr1971 Level 1

                  Hi and thank you.

                   

                   

                  Is there a way to display a message right after the submit button is clicked and before the email client opens?

                  Thanks!!!!

                  • 6. Re: Email script
                    Mandy_Wiesener Level 3

                    For which reason?

                    You want check if the message is correct?

                    • 7. Re: Email script
                      ashr1971 Level 1

                      A simple message like thank you for submitting the form.

                      • 8. Re: Email script
                        Mandy_Wiesener Level 3

                        You can solve this about the

                         

                        xfa.host.messabeBox(Nachricht, "Information for user.", 1, 0);
                        
                        • 9. Re: Email script
                          FrankB@FDA

                          Hi, this is great info for me as I've been trying to manage a BUTTON to send out an email strictly as a PDF file.  The attached form needs to be in the name the form was initially saved.  I'm using your example below but it is sending the PDF form as an XML file.  My problem is I'm not sure what type of "Control Type" button under the "Field" object I should use and I want to make sure that form sent is 1) In the name of the form being sent, and 2) is being sent as a PDF file.  Thanks for your help...

                           

                          1. //cSubmitAs: "PDF" send the pdf as attachment 
                          2. //cSubmitAs: "XML" send the pdf as xml-attachment 
                          3. event.target.submitForm({ 
                          4. cURL: Mail, 
                          5. bEmpty: true, 
                          6. cSubmitAs: "XML" 
                          7. });