Jump to content
Claris Engage 2025 - March 25-26 Austin Texas ×

Once Again.. emailing from XSL


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

Recommended Posts

Posted

I have tried everything under the sun...hoping someon can help out. I am attempting to email results from a form. The email shows up perfectly. The subject line is perfect..... the info in the Body of the email i cannot get correct. Here is my code for the email: (note that 'Sel' & 'Title' are fields in my database) The result of this would be--- SelTitle---- with no breaks. How can I get the email to format with all my data broken into seperate lines.

xsl:variable name="email_status" select="fmxslt:send_email('[email protected][email protected]&subject=Music Connection has received your BOM&',concat('Sel#:',fmrs:resultset/fmrs:record/fmrs:field[@name='Sel'],/,'Title:',fmrs:resultset/fmrs:record/fmrs:field[@name='Title']))"/

thanks for any input

Brad

Posted

I'm little bit too nitpicking (correct expression?), but can you assume that you always get back one record in resultset? Otherwise you should really address the record.

Why do you need the / between the two commas (this would be the XPath of the root node of your XML tree)?

Try this:

<xsl:variable name="bz" select="fmrs:resultset/fmrs:record[1]">

<xsl:variable name="email_status" select="fmxslt:send_email('[email protected][email protected]&subject=Music Connection has received your BOM',concat('Sel#:',$bz/fmrs:field[@name='Sel']/fmrs:data[1],&xD;,'Title:',$bz/fmrs:field[@name='Title']/fmrs:data[1]))"/>

The &xD; is the character expression for the carriage return.

Martin

Posted

Thank you for the code...i will test it out.

What do you mean by "really address the record"? If b yt his you mean show the entire record the YES! How would I do this?

thanks Again

Brad

Posted

Using your exact code I am getting an error of "The reference to entity sunject must end with a ';' delimiter

I canot seem to get this corrected. Any suggestions?

thanks

brad

Posted

Also telling me that the &xD was reference but not declared. Sorry for the basic questions but I am a newbie just trying to help out my family business.

Posted

Beautiful... that works. Now this leads into a new issue though. In actuality I have about 30 fields that need to be listed in this email. It seems as soon as I get to about 20 lines I get the follwoing error:

java.lang.ArrayIndexOutOfBoundsException: 16

I think this is a limit to the size of the string. Do you know how to increase this size?

For refernce here is the code I am using now:

xsl:variable name="bz" select="fmrs:resultset/fmrs:record[1]"/

xsl:variable name="email_status" select="fmxslt:send_email('[email protected][email protected]',

concat('Sel#:',$bz/fmrs:field[@name='Sel']/fmrs:data[1],

' ','Title:',$bz/fmrs:field[@name='Title']/fmrs:data[1],

' ','Title:',$bz/fmrs:field[@name='Title']/fmrs:data[1],

' ','Title:',$bz/fmrs:field[@name='Title']/fmrs:data[1],

' ','Title:',$bz/fmrs:field[@name='Title']/fmrs:data[1],

' ','Title:',$bz/fmrs:field[@name='Title']/fmrs:data[1],

' ','Title:',$bz/fmrs:field[@name='Title']/fmrs:data[1],

' ','Title:',$bz/fmrs:field[@name='Title']/fmrs:data[1],

' ','Title:',$bz/fmrs:field[@name='Title']/fmrs:data[1],

' ','Title:',$bz/fmrs:field[@name='Title']/fmrs:data[1],

' ','Title:',$bz/fmrs:field[@name='Title']/fmrs:data[1],

' ','Title:',$bz/fmrs:field[@name='Title']/fmrs:data[1],

' ','Title:',$bz/fmrs:field[@name='Title']/fmrs:data[1],

' ','Title:',$bz/fmrs:field[@name='Title']/fmrs:data[1],

' ','Title:',$bz/fmrs:field[@name='Title']/fmrs:data[1],

' ','Title:',$bz/fmrs:field[@name='Title']/fmrs:data[1],

' ','Title:',$bz/fmrs:field[@name='Title']/fmrs:data[1],

' ','Title:',$bz/fmrs:field[@name='Title']/fmrs:data[1],

' ','Title:',$bz/fmrs:field[@name='Title']/fmrs:data[1],

' ','Title:',$bz/fmrs:field[@name='Title']/fmrs:data[1],

' ','Title:',$bz/fmrs:field[@name='Artist']/fmrs:data[1]))"/

Posted

Interesting, it seems that concat() has a limited number of strings to be concatted. Did you try nested concats?

Or even, you can save half of your

' ','Title:',$bz/fmrs:field[@name='Title']/fmrs:data[1] construct in a variable first:

<xsl:variable name="firsthalf" select="

concat(' Title:',$bz//fmrs:field[@name='Title']/fmrs:data[1],' Title:'....)"/>

and the other half: <xsl:variable name="secondhalf" select="analogous..."/>

and then:

<xsl:variable name="email_status" select="fmxslt:send_email('[email protected][email protected]&subject=Music Connection has received your BOM',concat('Sel#:',$bz/fmrs:field[@name='Sel']/fmrs:data[1],' ','Title:',$bz/fmrs:field[@name='Title']/fmrs:data[1],$firsthalf,$secondhalf))"/>

BTW, you can substitute 'bz' by 'record' (that was a little joke I tried to find out if you are "the" brad2610).

Martin

  • Newbies
Posted

As a side note is there any ability for XSL to call the email address from the completed form and send an email to that user i.e. feedback from form logged, I have tried something like this but there is no response at all via the browser

xsl:variable name="email_feedback" select="fmxslt:send_email(fmrs:resultset/fmrs:record/fmrs:field[@name='Email2']/fmrs:data,'[email protected]&subject=Job Logged',concat(fmrs:resultset/fmrs:record/fmrs:field[@name='LocationE']/fmrs:data,' ','Descr:',fmrs:resultset/fmrs:record/fmrs:field[@name='FaultDescription']/fmrs:data))"/

Tomos

Posted

Seems to get a long thread here wink.gif

One of the three variants of the fmxslt:send_email extension function is of the following form:

fmxslt:send_email(String smtpFields, String body)

Now you have something like: fmxslt:send_email(String to_address, String remaining_smtpFields, String body). Compare with your construct.

Therefore, you should concat the strings to_address and remaining_smtpFields like this:

<xsl:variable name="email_feedback" select="fmxslt:send_email(concat(fmrs:resultset/fmrs:record/fmrs:field[@name='Email2']/fmrs:data,'[email protected]&subject=Job Logged'),concat(fmrs:resultset/fmrs:record/fmrs:field[@name='LocationE']/fmrs:data,' ','Descr:',fmrs:resultset/fmrs:record/fmrs:field[@name='FaultDescription']/fmrs:data))"/>

Martin

  • Newbies
Posted

May the choirs of the heavens sing you to sleep.... Fantastic, I tried using concat, but neglected to include the from string.

It works, it works, it works..... laugh.gif

if you had not guessed I was kind of impressed. I have had issues migrating my databases from Fm6 to 7 as I utilise a lot of AppleScript to complete the short comings of Filemakers GUI (mind you try doing some of my scripts in any other Database app.... wink.gif), but nothing prepared me moving from CDML (Database web forms 101) to XSL.....

Thanks heaps

Tomos grin.gif

BTW, if anyone is looking at implementing this there is only one small addition that has to be made to the code, between the ampersand and the "subject" name you will need "amp;" i.e. .au&amp;subject

Minor really......

This topic is 7219 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.