Jump to content
View in the app

A better way to browse. Learn more.

FMForums.com

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

How do I specify multiple names in mail to field in XSLT?

Featured Replies

Once I returned to my work environment, I was able to get the email to work once again (reference topic of getting email to work in different environment), except for the fact that I am unable to specify more than one email address in the toemail field (i.e., it works with only one recipient).

I have tried the following, to no avail:

;

blank space

paragraph marker

Any idea what the magic separator should be???

  • Author

I also tried commas.

The FMSA CWP Guide, p. 66, is clear how one can send e-mails to additional recipients:

recipient1@host1?from=sender@sendinghost&to=recipient2@host2&to=recipient3&host3&to=...

  • Author

Does this mean that I can't just define a FMP field like toemail with separators of some kind? Most of my systems have several recipients which are dynamically created, so it would not be possible to put them in the XSLT. In many cases, there are more than 20 recipients, all different for different records.

No no, this can be done easily.

Let's assume you have your recipients in a related table to_recipients in separate records.

Let's assume also that the current record is stored in a variable current-record.

Let's assume further that you have a portal in your layout with table to_recipients and field to.

Then you can use the following code:










&to=









concat() does what it says: it concatenates strings.

Also the other case is possible: All the recipients in one field, separated with commas.

Define one calculation field which holds the first recipient.

Define another calculation field that takes all the remaining recipients and replaces the commas with "&to="

Use these fields and the concat() function in fmxslt:send_email

  • Author

Where is the Code that should be in the box?

I will try your other suggestion and see if I can get it to work.

Thanks.

I was interrupted by a phone call. See now there.

  • Author

I think I am close, but the email does not seem to go to the send recipient. Here is my code:

select="fmxslt:send_email(concat($toemail,'[email protected]&[email protected]&subject=',$subject,$toemailrest),$emailWaivbody)"/>

I think that I put the $toemailrest variable in the wrong place.

What do you think?

Shirley

I think you need to specify the first recipient separately. That is

fmxslt:send_email( concat( $first-recipient, '?', $other-recipients, ... )

First recipient does not need to have ‘to=’ prefix; others must.

Offtopic: is there a way to receive notifications from this forum by email? Some time age there was a ‘subscription’ feature, but now it's missing and I simply cannot track my posts and replies.

  • Author

I did put the first recipient first and used the "to=" only for the second, but the second never got the email (and I got no error message)???

select="fmxslt:send_email (concat($toemail,'?from=m [email protected]&[email protected]&subject=',$subject,$toemailrest),$emailWaivbody)"/>

By the way, when I post a message, it sometimes seems to add in spaces in the body of the xslt.

Any idea why the second recipient ($toemailrest) got nothing?

  • Author

When I put a literal string in the fmxslt, as in:

select="fmxslt:send_email(concat($toemail,'[email protected]&[email protected]&subject=',$subject,'&[email protected]&[email protected]'),$emailWaivbody)"/>

both of the other recipients got email.

However, when I put in the same thing in a field, they got nothing:

select="fmxslt:send_email(concat($toemail,'[email protected]&[email protected]&subject=',$subject,$toemailrest),$emailWaivbody)"/>

$toemailrest = '&[email protected]&[email protected]'

I think that I am close, but I really need to figure out why the same thing in a field does not work (no error message, just no email).

Please HELP!!!!

Hmm. The only thing I'd try to check is that the $toemailrest variable contains exactly the text you want, i.e.

&[email protected]&[email protected]

But I figure you probably did this already. So I'm puzzled ???

Hmm. It could be a problem of output-escaping, i.e. that the & are replaced by & amp; in the XML result tree, and hence the & separator is not recognized anymore.

You may try to do the following when defining the variable toemailrest:








  • Author

Hi,

I did specify toemailrest as a variable, but nothing changed.

Could it be the version of the Server that I am using (it is actually FMP7 Server with FMP7 Developer with an extended license to do testing)?

I am puzzled as well as to why this does not work.

Once again, here is the excerpt from XSLT:

select="fmxslt:send_email(concat($toemail,$toemailrest,'[email protected]&[email protected]&subject=',$subject),$emailWaivbody)"/>

As far as toemailrest is concerned, the field is defined as:

'&[email protected]&[email protected]'

I have tried various combinations for defining toemailrest, but nothing except for a direct definition (i.e., not in a variable) works.

Try as given above, with disable-output-escaping="yes"

  • Author

Martin,

Is this what you meant?

Hopefully you meant something else, but the above didn't work either.

Please post your code here, the XSLT file and the FM file (I need only one record with an example address, so have not to bother about data protection).

  • Author

Martin,

My XSLT file is attached, along with the FM File (username and pw are both Admin--).

Hope this is what you need.

frezmod.zip

WebWaiversClone051407.zip

Mmmh. The field MMEmailrest was empty. Is it supposed to be like that?

  • Author

The MMEmailrest field in the record that I sent you (in WebWaivers) was:

&[email protected]

Are you talking about the field in the XSLT???

No, the field in the database. It was empty. Ok, I check with the value you suggested.

The problem was not the MMEmailrest field. The XSLT code is ok and can even be made shorter:

KB article 3604 . These things you can debug in the XSLT by adding the following line right after the body tag:








The problem is, that the MMEmailbeg field (and similar fields) was stored as global.



Global fields in a file hosted by FMS(A), however, behave differently than in a non-shared solution. In a hosted scenario, global fields are stored per client, i.e. each client can have a different global field value, and the host does not update their values.  The initial value of the global field is taken from the host and is the one that was set when the file was uploaded to FMS(A). In your case it was empty at this moment, that's why fmxslt:send_email did not work: it had an empty $toemail address. 



See  



This displays the fmresultset XML tree, and one can check which fields are on the layout and which values they carry.

The best ist, you define these e-mail fields as standard text fields, or, to save disk space, use a separate table (with only one record) having these fields.

  • Author

Martin,

I tried your suggestion, but still got an error 10202 (SMTP field error). When I removed the $toemailrest field, it worked. I tried the field with and without an extra set of single quotes, but to no avail.

I also looked at the debug info. Is there any way to see what the send_email string actually translates to???

I have attached the debug info from the one that failed.

I think we are close, once again, but something is still not quite right.

By the way, I should have mentioned before that I had gotten the email to work, but with no $toemailrest field showing up in the mail message. The $toemail was OK, though I'm not sure how - maybe because the environment that I am using is my own machine, with the test license that was sold with FMP 7 Advanced.

What now?

debug.zip

Remove both apostrophes (inverted commas) ' in the MMEmailrest field.

  • Author

Hi Martin,

I removed the apostrophes, but that didn't help. When I put the $toemailrest variable after the $toemail variable, I got a "to field error " (10202). I then put it after the subject and got a "SMTP field error" (10203). Here is the second example:

select="fmxslt:send_email(concat($toemail,'[email protected]&[email protected]&subject=',$subject,$toemailrest),$emailWaivbody)"/>

$toemailrest is now defined as:

&[email protected]

I just thought I would try one to see if that worked.

If there was a way to see the expansion of the rest of the send_email, maybe we got figure out the problem!

I don't understand - yesterday I uploaded your db and the stylesheet to our server, and after filling out MMEmailrest and MMEmailbeg correctly and defining them as standard text fields everything worked; you got the confirmation e-mail.

Oh yes, change & amp; to & in MMEmailrest.

  • Author

It WORKED!!!!!

The documentation seems to indicate that you always use the "&", not just the "&". By the way, I did see the email that you sent, but thought it was one of the many that I have been sending for the past few days, so I didn't realize that you had sent it.

Thank you, thank you, thank you for all your help and patience with this problem!!!

Now I can complete my updates to my systems, since this was one of the last hurdles to get over.

I do wish that the documentation for this function was better. I guess that's why some people have not begun to use XSLT, but went to PHP instead. I looked at that, but didn't want to rewrite so many of my pages.

Create an account or sign in to comment

Important Information

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

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.