Jump to content
Server Maintenance This Week. ×

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


sgasch

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

Recommended Posts

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???

Link to comment
Share on other sites

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.

Link to comment
Share on other sites

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

Link to comment
Share on other sites

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.

Link to comment
Share on other sites

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?

Link to comment
Share on other sites

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!!!!

Link to comment
Share on other sites

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.

Link to comment
Share on other sites

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.

Link to comment
Share on other sites

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

Link to comment
Share on other sites

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!

Link to comment
Share on other sites

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.

Link to comment
Share on other sites

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.

Link to comment
Share on other sites

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