Hi,
I have an issue when trying to do Velocity substitutions using the Mail interface's messageTemplate parameter. The problem is that the variable substitution is not performed as expected.
When I switch to using the templateFile approach, everything works fine. Is this the intended behavior? I would like to use the messageTemplate approach instead of templateFile, as my messageTemplates are stored in a SQL database.
Here's my datasource definition:
Here's the template text (same for both the file and the messageTemplate string):
The resulting message when using the messageTemplate contains the literal string '$message_subject' while the message generated using the templateFile has the properly substituted string.
As a side issue, I wonder if it is also possible to support this 'nested' variable substitution in the other fields of the Mail interface. Specifically, my application requires creating a subject line based on a few extra columns from the database, and if I could do similar substitution in that field it would be ideal. Does this seem like a reasonable request/use case?
Any insight would be greatly appreciated.
Thanks for your time,
Mike
SmartClient Version: SNAPSHOT_v8.3d_2012-09-04/PowerEdition Deployment (built 2012-09-04)
Browsers: FF15,IE9
I have an issue when trying to do Velocity substitutions using the Mail interface's messageTemplate parameter. The problem is that the variable substitution is not performed as expected.
When I switch to using the templateFile approach, everything works fine. Is this the intended behavior? I would like to use the messageTemplate approach instead of templateFile, as my messageTemplates are stored in a SQL database.
Here's my datasource definition:
Code:
<DataSource schema="bemailer_test" dbName="v3_sandbox" tableName="mail_messages_queue" ID="mail_messages_queue" serverType="sql" > <fields> <field name="message_id" title="Message ID" primaryKey="true" type="integer"/> <field name="message_to" title="To" type="text"/> <field name="message_from" title="From" type="text" detail="true"/> <field name="message_replyto" title="ReplyTo" type="text" detail="true"/> <field name="message_subject" title="Subject" type="text" detail="true"/> <field name="message_body" title="Body" type="text" length="8192" detail="true"/> </fields> <operationBindings> <operationBinding operationType="fetch"> <mail contentType="text/html"> <to>$message_to</to> <from>$message_from</from> <replyTo>$message_replyto</replyTo> <subject>$message_subject</subject> <templateFile>mail_template.txt</templateFile> <!-- <messageTemplate> <html> <body> $message_body </body> </html> </messageTemplate> --> </mail> </operationBinding> </operationBindings> </DataSource>
Code:
Dear user, <br/> <br/> This is an attempt at dereferencing a Velocity variable: <br/> <br/> $message_subject <br/> <br/>
As a side issue, I wonder if it is also possible to support this 'nested' variable substitution in the other fields of the Mail interface. Specifically, my application requires creating a subject line based on a few extra columns from the database, and if I could do similar substitution in that field it would be ideal. Does this seem like a reasonable request/use case?
Any insight would be greatly appreciated.
Thanks for your time,
Mike
SmartClient Version: SNAPSHOT_v8.3d_2012-09-04/PowerEdition Deployment (built 2012-09-04)
Browsers: FF15,IE9
Comment