I have created some velocity script for an event program I am creating so that I can display the multiple sessions someone registers for in one autoresponder. It is working, although it is indenting when the values show in the email. Here is the script:
#if ($lead.rentalAMER12.contains("D1-AIML-01"))
<table>
<tr>
<td>#N/A</td>
</tr>
<tr>
<td>12:00-12:40pm - Room 100</td>
</tr>
<tr>
<td> </td>
</table>
<br>
#end
Here is the test email that has #N/A in place of the session title
Is there any easy way to get it to be left aligned?
Well, Velocity preserves all your spacing (it’s just outputting regular HTML). So this wouldn’t be related to Velocity. More like the surrounding table element is set to center its contents.
P.S. If this is a multivalued field, using contains() directly on the string is poor practice because of delimiter collisions. You should instead split the string on the delimiter, i.e. split("\s*;\s*"), and run contains() on the resulting array.
The script seems correct, the only issue is you have an unclosed tag in the html.
Here is the correct one.
#if ($lead.rentalAMER12.contains("D1-AIML-01"))
<table>
<tr>
<td>#N/A</td>
</tr>
<tr>
<td>12:00-12:40pm - Room 100</td>
</tr>
<tr>
<td> </td>
</tr>
</table>
<br>
#end