How to make an app - Andromo App Maker


No announcement yet.

Email Input Text ??

  • Filter
  • Time
  • Show
Clear All
new posts

  • Email Input Text ??

    Hello....I'm trying to have an email open and fill in the blanks...My question is how to I get a variable outputted in the body of the message ???

    Here's what I'm playing with...

    result = firstname;

    File.OpenEmail("[email protected][email protected][email protected]&Subject=Your subject here&Body=%result%", SW_SHOWNORMAL);

    Any ideas would be helpful...


  • #2
    This should work:

    result = firstname;

    File.OpenEmail("[email protected][email protected][email protected]&Subject=Your subject here&Body=" .. result, SW_SHOWNORMAL);


    • #3
      This is a great site to use also.

      Great site


      • #4
        Multipe Items ?

        Thanks CWRIGHT.....Any idea on how I can do multiple items instead of just one variable ? The entries are comming from a form I created with mutiple user entries...I want all these entries sent to the body of the email.

        Thanks for any help


        • #5
          To save space you might want to build the body as a variable and then put that into your File.OpenEmail action. For instance:

          input1 = "Fname Lname"
          input2 = "123 anystreet"
          input3 = "AnyTown"
          input4 = "IA"
          input5 = "52402"
          input6 = "I am writing you to tell you about the wonderful resource you have provided to me in this AMS5 product"
          result = input6 .. "\r\n" .. input1 .. "\r\n".. input2 .. "\r\n".. input3 .. ", " .. input4 .. "  " .. input5
          File.OpenEmail("[email protected][email protected]&[email protected]&Subject=Your subject here&Body=" .. result, SW_SHOWNORMAL);
          I hope that helps
          "A common mistake that people make when trying to design something completely foolproof was to underestimate the ingenuity of complete fools."
          "Draco dormiens nunquam titillandus."
          Map of IR Forum Users - IR Project CodeViewer - Online Help - TiggTV - QuizEngine


          • #6
            Yep, I'd do it as TJ_Tigger has shown, perhaps even use variables for the email addresses as well. The AMS help has some good examples on concatenating strings.

            Please note that you will need to use %0D%0A rather than \r\n for a return/new line as it is a URL being used with the File.OpenEmail action (see Bruce's link).


            • #7
              Problem With Multiple Pages ?

              That all works great !!

              Here's my next problem.....I have two pages to be filled out before the email is sent.....After page 1 is filled out the user hits the "next" button to continue on to page 2....The problem is that the inputted user data from page 1 is lost and only page 2 data is posted to the email ???

              Any ideas why the inputted info is lost from page one to page two ?

              --"Page 1 - Next page buton - ON CLICK"
              input1 = Input.GetText("alternatename");
              input2 = Input.GetText("alternateaddress");
              input3 = Input.GetText("motherhealthcard");
              input4 = Input.GetText("motherbirthdate");
              input5 = Input.GetText("alternatetelephone");
              input6 = Input.GetText("alternatefax");
              input7 = Input.GetText("alternaterelationship");
              input8 = Input.GetText("alternateapt");
              input9 = Input.GetText("fatherhealthcard");
              input10 = Input.GetText("fatherbirthdate");
              input11 = Input.GetText("fatherworktelephone");
              input12 = Input.GetText("fatherworkfax");
              input13 = Input.GetText("alternateemail");
              input14 = Input.GetText("aptnumber");
              input15 = Input.GetText("alternatecity");
              input16 = Input.GetText("alternateprovince");
              input17 = Input.GetText("alternatepostalcode");
              input18 = Input.GetText("hometelephone");
              input19 = Input.GetText("fax");
              input20 = Input.GetText("email");
              input21 = Input.GetText("deliverydate");
              input22 = Input.GetText("hospital");
              input23 = Input.GetText("hospitalcity");
              input24 = Input.GetText("doctor");
              input25 = Input.GetText("doctortelephone");
              input26 = Input.GetText("doctorfax");
              input27 = Input.GetText("doctoraddress");


              --"Page 2 - Send buton - ON CLICK"
              input28 = Input.GetText("alternatename");
              input29 = Input.GetText("alternaterelationship");
              input30 = Input.GetText("alternateaddress");
              input31 = Input.GetText("alternateapt");
              input32 = Input.GetText("alternatecity");
              input33 = Input.GetText("alternateprovince");

              input34 = Input.GetText("alternatepostalcode");
              input35 = Input.GetText("alternatetelephone");
              input36 = Input.GetText("alternatefax");
              input37 = Input.GetText("alternateemail");
              input38 = Input.GetText("alternatecomment");

              --Mothers info printed to email
              result = "Mother's First Name:" .. "%0D%0A" .. input1 .. "%0D%0A%0D%0A" .. "Mother's Last Name:" .. "%0D%0A" .. input2 .. "%0D%0A%0D%0A" .. "Mother's Health Card #:"
              .. "%0D%0A" .. input3 .. "%0D%0A%0D%0A" .. "Mother's Bith Date:" .. "%0D%0A" .. input4 .. "%0D%0A%0D%0A" .. "Mother's Work Telphone #: " .. "%0D%0A" .. input5
              .. "%0D%0A%0D%0A" .. "Mother's Work Fax #:" .. "%0D%0A" .. input6
              --fathers info printed to email
              .. "%0D%0A%0D%0A" .. "----------------------------------------------------" .. "%0D%0A%0D%0A"
              .. "Father's First Name:" .. "%0D%0A" .. input7 .. "%0D%0A%0D%0A" .. "Father's Last Name:" .. "%0D%0A" .. input8 .. "%0D%0A%0D%0A" .. "Father's Health Card #:"
              .. "%0D%0A" .. input9 .. "%0D%0A%0D%0A" .. "Father's Bith Date:" .. "%0D%0A" .. input10 .. "%0D%0A%0D%0A" .. "Father's Work Telphone #: " .. "%0D%0A" .. input11
              .. "%0D%0A%0D%0A" .. "Father's Work Fax #:" .. "%0D%0A" .. input12
              --General info printed to email
              .. "%0D%0A%0D%0A" .. "----------------------------------------------------" .. "%0D%0A%0D%0A"
              .. "Home Address:" .. "%0D%0A" .. input13 .. "%0D%0A%0D%0A" .. "Apt #:" .. "%0D%0A" .. input14 .. "%0D%0A%0D%0A" .. "City:" .. "%0D%0A"
              .. input15 .. "%0D%0A%0D%0A" .. "Province:" .. "%0D%0A" .. input16 .. "%0D%0A%0D%0A" .. "Postal Code: " .. "%0D%0A" .. input17 .. "%0D%0A%0D%0A"
              .. "Home Telephone #:" .. "%0D%0A" .. input18 .. "%0D%0A%0D%0A" .. "Home Fax #:" .. "%0D%0A" .. input19 .. "%0D%0A%0D%0A" .. "Email:" .. "%0D%0A" .. input20
              --Medical info printed to email
              .. "%0D%0A%0D%0A" .. "----------------------------------------------------" .. "%0D%0A%0D%0A"
              .. "Delivery Date:" .. "%0D%0A" .. input21 .. "%0D%0A%0D%0A" .. "Hospital:" .. "%0D%0A" .. input22 .. "%0D%0A%0D%0A" .. "Hospital City: " .. "%0D%0A"
              .. input23 .. "%0D%0A%0D%0A" .. "Doctor:" .. "%0D%0A" .. input24 .. "%0D%0A%0D%0A" .. "Doctor Telephone #:" .. "%0D%0A" .. input25 .. "%0D%0A%0D%0A"
              .. "Doctor Fax #:" .. "%0D%0A" .. input26 .. "%0D%0A%0D%0A" .. "Doctor Address:" .. "%0D%0A" .. input27
              --Alternate info printed to email
              .. "%0D%0A%0D%0A" .. "----------------------------------------------------" .. "%0D%0A%0D%0A"
              .. "Alternate Name:" .. "%0D%0A" .. input28 .. "%0D%0A%0D%0A" .. "Alternate Relationship:" .. "%0D%0A" .. input29 .. "%0D%0A%0D%0A" .. "Alternate Address: " .. "%0D%0A"
              .. input30 .. "%0D%0A%0D%0A" .. "Alternate Apt#:" .. "%0D%0A" .. input31 .. "%0D%0A%0D%0A" .. "Alternate City:" .. "%0D%0A" .. input32 .. "%0D%0A%0D%0A"
              .. "Alternate Province:" .. "%0D%0A" .. input33 .. "%0D%0A%0D%0A" .. "Alternate Postal Code:" .. "%0D%0A" .. input34 .. "%0D%0A%0D%0A"
              .. "Alternate Telephone:" .. "%0D%0A" .. input35 .. "%0D%0A%0D%0A" .. "Alternate Fax:" .. "%0D%0A" .. input36 .. "%0D%0A%0D%0A"
              .. "Alternate Email:" .. "%0D%0A" .. input37 .. "%0D%0A%0D" .. "Alternate Comment:" .. "%0D%0A" .. input38

              File.OpenEmail("[email protected]&Subject=Regist ration Submission&Body=" .. result, SW_SHOWNORMAL);


              • #8
                One option is to make your ..result a global function.


                Music | Video | Pictures


                • #9
                  How would I get all those inputs into the Global Functions ?


                  • #10
                    variables are global so make sure that you are not overwritting the result variable when you jump to Page2. I would suggest changing your "result" variable to something else like "emailbody" since "result" is often the default return variable for most actions.
                    "A common mistake that people make when trying to design something completely foolproof was to underestimate the ingenuity of complete fools."
                    "Draco dormiens nunquam titillandus."
                    Map of IR Forum Users - IR Project CodeViewer - Online Help - TiggTV - QuizEngine


                    • #11
                      No go....I changed my variable name just to be sure but still the same result....after I jump from page 1 to page 2 I lose all the inputted data from page 1....Page 2 inputs are fine just page 1 is lost ????

                      Any other ideas why I'm losing Page 1 Inputted data ??


                      • #12
                        No idea why you are losing your variable info - what TJ_Tigger said makes most sense.

                        However, you could make life easier for yourself by entering the info into a table rather than that very long string. The attached project shows you how this would work.

                        All labels and inputs need to be consecutively numbered. You can then use a loop to read each item of label text and inputted text into a table.

                        This table is then written to a string (with the return/newline as a delimeter) and this is then used to create the email body. You can even insert lines into the table to create your section seperators.

                        Let me know if you have any questions.

                        Attached Files


                        • #13
                          Thanks CWRIGHT,

                          I put together code as you can see below but now I'm really stumped ???.....This was working fine till I did a in depth test....I can only fill in about 3/4 of the fields of page 1 and then it won't open an email anymore ????

                          I filled in all 38 inputs over the two pages and then hit the send button....Nothing happened....I then started deleting field by field untill I got to about 15 fields on page 1 filled in then it would open an Email again ??? anything over that 15 or so and no email....

                          Any help with this would extremely appreciated....!!!

                          The code is below...

                          --Page 1

                          tEmailBody = {};

                          for x=1, 27 do -- start and end label and input numbers on page

                          local sLabel = Label.GetText("Label" .. x);
                          local sInput = Input.GetText("input" .. x);

                          tEmailBody[x] = sLabel.."%0D%0A"..sInput;



                          --Page 2

                          for x=28, 38 do -- start and end label and input numbers on page

                          local sLabel = Label.GetText("Label" .. x);
                          local sInput = Input.GetText("input" .. x);

                          tEmailBody[x] = sLabel.."%0D%0A"..sInput;


                          sDividerA = "----------------Mother's Information----------------%0D%0A"
                          sDividerB = "%0D%0A----------------Father's Information----------------%0D%0A%0D%0A"
                          sDividerC = "%0D%0A----------------General Information-----------------%0D%0A%0D%0A"
                          sDividerD = "%0D%0A----------------Medical Information-----------------%0D%0A%0D%0A"
                          sDividerE = "%0D%0A-----------Alternate Contact Information------------%0D%0A%0D%0A"
                          sDividerF = "%0D%0A----------------------Comments----------------------%0D%0A%0D%0A"

                          Table.Insert(tEmailBody, 1, sDividerA) -- insert a divide line into the table
                          Table.Insert(tEmailBody, 7, sDividerB) -- insert a divide line into the table
                          Table.Insert(tEmailBody, 15, sDividerC) -- insert a divide line into the table
                          Table.Insert(tEmailBody, 24, sDividerD) -- insert a divide line into the table
                          Table.Insert(tEmailBody, 32, sDividerE) -- insert a divide line into the table
                          Table.Insert(tEmailBody, 43, sDividerF) -- insert a divide line into the table

                          sBody = Table.Concat(tEmailBody, "%0D%0A%0D%0A", 1, TABLE_ALL) -- convert the table to a string

                          File.OpenEmail("[email protected]&Subject=R egistration Submission&Body=" .. sBody, SW_SHOWNORMAL);


                          • #14
                            Not sure, but I think you have probably exceeded the limit for the amount of data that can be passed via the OpenEmail action. Just guessing now, but as essentially we are just creating a very long URL here, there will be some restriction to the length to prevent buffer overflows etc.

                            Shame though - the table way of doing it was pretty neat.

                            Options would be to split each section into it's own email, or create a text file from the data, and send this as an attachment instead. I don't think this is easy with the OpenEmail action as you would need to Uuencode the file.

                            There are freeware external email applications which you could use that have their own SMTP email engine, and work from the command-line. I may be able to provide more info tomorrow when I am back at my work computer.



                            • #15
                              Blat.exe is the public domain SMTP program I was thinking of, and I notice there is also a DLL version. You could call this directly from AMS50 and attach all of your info either to a file attachment or a text file used for the email body.

                              So, once your table is generated, use the TextFile.WriteFromTable action to generate your text file, and then use DLL.CallFunction to send the email.

                              The attached project includes the code for calling the DLL and blat.dll itself. It should be easy to follow.

                              You will need to know the SMTP address of your email server, and ensure the "to" address is valid on that server (otherwise it will probably reject the email for trying to relay). Also be aware that some corporate firewalls may block SMTP port 25 from their users, preventing the sending of email using blat.

                              Link to blat site:

                              Hope this helps,
                              Attached Files