Jump to content

Email Revisted


This topic is 6605 days old. Please don't post here. Open a new topic instead.

Recommended Posts

Hello all you XML junkies.....

Hoping someone can give me a rundown on the following. I have a simple form that when submitted an email is sent out to the address that I specified in the script. Instead I would like the email to go to the user who has submitted the form. Each user has a unique login that is set up in FM accounts and Privleages. Any clue where to start on this. I am an advanced filemaker user but a newbie with this xml stuff.

here is the current code....

xsl:variable name="email_status" select="fmxslt:send_email('[email protected][email protected]&subject=Music Connection has received your edited BOM',

concat('Music Connection has received your edited BOM.',' ',' ','Date:',$bz/fmrs:field[@name='Date']/fmrs:data[1],$firsthalf,$secondhalf))"/

thanks for the help

Link to comment
Share on other sites

Well, this is a double problem. I didn't test all of that, but let's try:

First part: The e-mail addresses in your script must be stored in a table.

Create a table users with fields accountname and email_address and transfer the info in your script there. Create a layout WWW_users that holds your table.

Second part: You can query now this info inline in the XSLT.

According to the FMS7A CWP Guide, p. 56, the client user name is stored in the parameter client-user-name. You find a lot of tricks used here on p. 56 and on the next page. With the user information and the document() function, you can first the XML tree in fmresultset grammar in a variable userdata, and then extract the email address of it and store it in a variable email. Then you just have to modify your fmxslt:send_email function with $email.

So you would have something like:

<?xml version="1.0" encoding="UTF-8"?>

<xsl:stylesheet version="1.0" ...>



<xsl:param name="authenticated-xml-base-uri"/>

<xsl:param name="user-client-name"/>

<xsl:variable name="userdata" select="document(concat($authenticated-xml-base-uri,'/fmi/xml/fmresultset.xml?-db=yourdatabase&-lay=WWW_users&accountname=',$user-client-name,'&-max=1&-find'))"/>

<xsl:variable name="email" select="$userdata/fmrs:fmresultset/fmrs:resultset/fmrs:record[1]/fmrs:field[@name = 'email_address']/fmrs:data[1]"/>



<xsl:template match="...">

and then somewhere here your fmxslt:send_email(....

Make sure that the parameters are defined before <xsl:template ...>

I hope I haven't entered some typo as the last time



Link to comment
Share on other sites

This topic is 6605 days old. Please don't post here. Open a new topic instead.

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
  • Create New...

Important Information

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