6 Replies Latest reply on May 5, 2017 4:05 PM by ndveitch

    Merge html text in FileMaker


      Hi There,


      I need to find out how I would merge two sets of HTML code for a built in email module I have. I need to add HTML signatures into the body of the email. I have the HTML code for the body of the email and the HTML code for the signatures but I am not sure how to get the signature code into the email code.


      The signature will need to go at the end of the code. Similar to this, </p>  ( signature code )  </body></html>. The signature code is self encased and I tested it in a viewer. It was easy to add in the editor, because that was just copy and paste, but I am not sure on how to do that correctly in FileMaker. I saw something like this in a webinar and I think Position() was used, but I am not to sure how to go about it.


      The signatures are stored in global fields in my globals table so that I would be able to update the html code based on the User that is sending the email. Well that was the idea.

        • 1. Re: Merge html text in FileMaker

          This calculation will put the signature field before the end body tag:


          Let ( pos = Position ( Body ; "</body>" ; 1 ; 1 )


          Left ( Body ; pos -1 )




          Right ( Body ; Length ( Body ) - pos +1 )



          Providing you have a field named Body and a field named Signature

          1 of 1 people found this helpful
          • 2. Re: Merge html text in FileMaker

            Thank you so much for this. I was trying to use the substitute function in the let as I need to also work in which of the users signature to use.


            Let ( [

            var1 = Get(AccountName) ;

            var2 =  Case (

            PatternCount( var1 ; "Bob" ) > 0 ; 1 ;

            PatternCount( var1 ;  "Mary" ) > 0 ; 2 ;

            PatternCount( var1 ; "Harry" ) > 0 ; 3 ;

            PatternCount( var1 ; "Admin" ) > 0 ; 4


            ] ;

            Substitute ( SendEMail::HTMLText ; "</body>" ; "¶¶" & Globals::EmailSignatures[var2] & "¶¶" & "</body>"  )


            • 3. Re: Merge html text in FileMaker

              I see you have your merge answer. Are you trying to send mail in FM as HTML body? Have you tested to see if it works?

              FileMaker Pro sends email messages as plain text.


              1 of 1 people found this helpful
              • 4. Re: Merge html text in FileMaker

                Hi Beverly,


                I have built an email module using the MonkeyBread plugin and it is working very well. The next thing I need to do is get the users signatures into the HTML email before the email is complied and sent.


                I have tested the above in the data viewer and it seems to be working. Now for the real test. Time to update my scripts and see if it works.

                • 5. Re: Merge html text in FileMaker

                  I would not use the calculation you posted in Reply #2.


                  What if Mary retires and John joins your organization? You then have to go in and rewrite your calculation--this is an example of "brittle" database design--a foreseeable change occurs and the system breaks until a developer goes in and fixes the problem.


                  Use the Account name to get the appropriate info from a table of personnel so that adding/removing personnel becomes a data entry task instead of a developer task.

                  1 of 1 people found this helpful
                  • 6. Re: Merge html text in FileMaker

                    Hi PhilMod,


                    Thank you for the post and I will need to keep this in mind.


                    At the moment I will be the one who updates the users, as there are only 4 users on the system, because of this we don't have a personnel table. When we do the next update I will get the chance to build in the personnel table, but for now I have to work around this.