Problems, need help? Have a tip or advice? Post it here.
3 posts Page 1 of 1
Hi,

I take an email as a php variable and put it into a couch variable like this:
Code: Select all
<cms:set tlemail = "<cms:php>global $tlemail;  echo '&lt;'.$tlemail.'&gt;';</cms:php>" />

if I now do
Code: Select all
<cms:show tlemail />

it works as expected and is displayed like this:
Code: Select all
<my.name@domain.com/>


I now want to put this into a send_mail block, but if I do the same thing inside the send_mail block, it doesn't work (it doesn't show up at all).

The ultimate goal is to have the send_mail from attribute to be "<cms:show name /> <cms:show email />" for a "My Name <my.name@domain.com/>" output.
Please post the part of your code where you are trying to use the variable in <cms:send_mail> tag.
I actually got it working where I need it now (through a lot of trial and error):

Code: Select all
//we set couch variables from php variables
<cms:set tlname = "<cms:php>global $tlname;  echo $tlname;</cms:php>" />   //My Name
<cms:set tlemail = "<cms:php>global $tlemail; echo $tlemail;</cms:php>" />    //my.name@domain.com

//using double gt/lt actually yields the desired result here (My Name <my.name@domain.com>)
<cms:send_mail from="<cms:show tlname /> <<cms:show tlemail />>" to='their.name@domain.com' subject="Subject">


Now this is actually enough for what I want to do. I also tried to display the the from= part as a debug string in the mail body. If I use html mail I can just use &lt;/&gt; or save it like that in the variable to begin with, which works. However, I still have not found a way to output it in a plain text mail. It's not a big problem, as I don't actually need it in the mail body. Still, it would be nice to know how to do it.

Code Example for the Mail body:

Code: Select all
Debug mail from: <cms:show tlname /> <<cms:show tlemail />> //This doesn't work


As I said I tried a lot of things, including like <cms:show '<' /> <cms:show tlemail /> <cms:show '>' /> or <cms:show '&lt;' /> <cms:show tlemail /> <cms:show '&gt;' />, varous tries with html_encode both in php and couch, putting the lt/gt signs in the variable to begin with etc etc. Nothing worked, it either shows only the brackets or nothing at all.
3 posts Page 1 of 1