Jump to content
Darren Burgess

return html from EmailSetBodyFile

Recommended Posts

Is it possible to get as a return value the HTML code derived from the EmailSetBodyFile function? for example, given the following code, I would like to get the resulting html back. I guess I could extract the html from the file and do the substitutions in using filemaker script steps, however i am wondering if it is possible to do with plugin functions.

EmailSetBodyFile( $_body_html_file ; 1 ) and
EmailBodySubstitute( $_preamble_replace_string ; $_body_html ) 
EmailBodySubstitute( $_signature_replace_string ; $_signature_html )


Share this post

Link to post
Share on other sites
ryan360Works    16

Hi Darren,

There is not a function in the Email plugin that will output the HTML after the substitutions. Your approach is probably the best way to accomplish this. The only way I can think of to do this with solely the Email plugin would be to send the email to yourself ( or any other inbox you can access) first and then do a read on the inbox, pull the email in and parse the html out of it using EmailReadMessageValue("html"). 

Share this post

Link to post
Share on other sites

You probably don't have to actually send the e-mail, try just saving it as a draft and then read the drafts folder.

Share this post

Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

  • Similar Content

    • By drrehak
      I am using EmailRecipients () , and we have noticed that sometimes duplicate emails are being sent. I had one customer who said they received 10!
      any ideas? My script is:
      Set Variable [ $result ; Value:EmailConnectSMTP("smtp.gmail.com:465";"info@**********.com";"*********";"ssl=1") ]
      If [ $result ≠ 1 ]
      Show Custom Dialog [ Message: EmailLastError & ¶ & "Feedback emails failed! Password most likely wrong. Tell Doc."; Default Button: “OK”, Commit: “Yes” ]
      Go to Layout [ original layout ]
      Exit Script [  ]
      End If
      #send email to foundset
      Go to Record/Request/Page [ First ]
      Loop Set Variable [ $first ; Value:patients::first ]
      Set Variable [ $email; Value:patients::email ]
      Set Variable [ $subject; Value:$first & ", Happy Birthday from Colonial Family Eyecare!" ]
      Set Variable [ $msgCreate ; Value:EmailCreate(  "info@************.com";patients::email  ;$subject ) and EmailSetBody( $$body)
      Set Variable [ $setRecipients ; Value:EmailRecipients($email) ]
      Set Variable [ $sent; Value:EmailSend ]
      If [ $sent ≠ 1 ]
      Show Custom Dialog [ Message: EmailLastError; Default Button: “OK”, Commit: “Yes” ; Button 2: “Cancel” , Commit: “No” ]
      End If
      Go to Record/Request/Page [ Next; Exit after last ]
      End Loop Set Variable [ $disconnect ; Value:EmailDisconnect ]
      If [ $disconnect="ERROR" ]
      Show Custom Dialog [ Message: EmailLastError; Default Button: “OK”, Commit: “Yes” ]
      Exit Script [  ]
      End If
    • By docasar
      I have just downloaded the 360works Email plugin Sample and I am doing some tests to check whether this would solve my problem. I would like to be able to download all emails from my email account into "messages" table and then on each customer record show those emails which are related to that customer via a portal based on a relationship between, but what I can not figure out how to do it is that the portal would show but types of emails those marked as "from" emails and those marketd as "to" emails. So far I have created a relationship between Customers::email  ------- Messages::From and the portal would show all "from" messages. If I would set the relationship as Customers:email ------ Messages:To, the portal shows all "to" messages, but what I am trying to make is a join portal that would show by date both "from" and "to" messages, then I plan to make a Conditional Formating saying that if Customers:email = Messages::From then all text in blue, and all text in green when it is TO.
      Is this something that can be achieved?
      Thanks a lot for any tip,
    • By FileDumb
      Hi everyone,
      I have done some research on this but cannot make headway so any help would be much appreciated!
      I am currently thus:
      • Using FM 13 pro advanced to create a runtime solution for use on Windows 7 PC
      • All well apart from when I go to a script to send an attachment by email... "email client not found" comes up...
      Tried setting the default email client but it doesn't show in default programs in Win 7
      Incidentally this system I created works ok in Mac! (but it won't be used on a Mac so...
      Many thanks in advance,
    • By LelandLong
      I read that the new 3.01 version does not require Java.
      When I run FMPAv16 on my Mac (10.11.6) and use the sample Email database it works just fine and I see nothing related to Java. I had the older v2.12 plugin installed on here and have just updated to v3.01 today.
      When I run FMPAv16 on a different Mac (10.11.6) and install the v3.01 plugin (never had the plugin installed on this machine before today) and run the sample database a Java App runs without any windows, Just visible in the lower right dock and its single menu is titled "Java"
      Any ideas as to this oddity?
      Leland Long
    • By DreadDamsel
      I've spent a lot of time searching around to try to figure this out - to no avail.
      I want to be able to send a single email (may be different each time the mailout is done) to multiple recipients that are the result of a find.
      I've created the script and it works fine EXCEPT I get a separate email window pops up for every recipient, into which I then have to complete the Subject and contents - not what I was hoping for. Even to do it as a an email to a single address (our organisation) and all others gathered as BCC opens up separate windows for each found record.
      Can someone please help me resolve this? If I can solve it for this list, then I can apply the same principle to the other 4 "finds" I need to be able to do.
      Using FMP12 Advanced on Mac (so using Mail), though the final product will be on Windows.

Important Information

By using this site, you agree to our Terms of Use.