Jump to content

{SMARTY} Tags in Email Subjects - Not Working


njolin

Recommended Posts

Hey Everyone,

Ever since the update to V6, we have been unable to use Smarty tags in the subjects of emails. If there are any tags, the subjects will go out blank.

 

I wanted to put this out there to see if anyone has found a workaround for this (other than removing the tags of course), and let people know of this bug.

 

I have raised a ticket with WHMCS, but they don't seem to think it's an important issue.

Link to comment
Share on other sites

Hi,

 

Ever since the update to V6, we have been unable to use Smarty tags in the subjects of emails. If there are any tags, the subjects will go out blank.

I can definitely confirm there is an issue, as I ran into it a few weeks ago. :mad:

 

however, the issue is not that Smarty tags don't work in email subjects with v6 - they work fine, e.g. if you modify the subject of the "Invoice Created" email template to "Customer Invoice - {$client_first_name}", the email sends with the correct subject and Smarty value added.

 

the problem seems to be if you start putting conditionals into the subject line, e.g our "Invoice Created" subject line is...

 

Customer Invoice {if $invoice_status eq "Cancelled"} - CANCELLED{/if}

 

that works fine in v5.3.14, but fails in v6 - the email is sent with no subject and the following entry is added to the activity log.

 

Smarty Error: Syntax error in template "mailTemplate:subject" on line 1 "Customer Invoice {if $invoice_status eq "Cancelled"} - INVOICE CANCELLED" - Unexpected "&"

what the form is doing, when adding the subject to the database table, is it's changing quotes to " - does a similar thing with single quotes too.... if you aren't using Smarty in the subject, then you can add quotes without an issue, but Smarty seems to be unable to parse " correctly.

 

it's definitely a bug as it works fine in v5.3.14, and i've not read of Smarty being deprecated in email subjects in any of the documentation.

 

I wanted to put this out there to see if anyone has found a workaround for this (other than removing the tags of course), and let people know of this bug.

the only workaround I found was to bypass the Email Template form and edit the subject directly in the tblemailtemplates database table... you can use phpmyadmin to do this... if you do this, then the above subject line will work with v6 with no issues. :idea:

 

but if you ever edit the template again using the Admin Area Email Template forms, it will change the quotes and the subsequent emails will be sent with blank subjects - so you'll then have to edit the subjects directly in the database again. :)

 

I have raised a ticket with WHMCS, but they don't seem to think it's an important issue.

sighs... i've raised it privately with one for the support guys too... but have had no response so far. :roll:

 

If I were you, i'd post it as a bug in the Bug Reports forum and see what Nate says... nevermind, I asked Infopro to move it to the Bug Reports forum and he kindly did. :idea:

 

also, you could update your ticket with a link to this thread... perhaps as i've explained where the issue actually is, the developers could fix it for v6.0.3 !

Edited by brian!
Link to comment
Share on other sites

Hello:

 

It's exactly as you say, the data is encoded in the database. The email code had a major overhaul in Verison 6, which is the reason for the regression from 5.3.14. Simple substitution tags work just fine, it's only conditionals or other more "complex" logic in the subject that triggers the bug.

 

The case number is CORE-8922, and it's been merged into 6.1.0 RC 1: "CORE-8922 - Email subjects should allow Smarty conditional logic" http://docs.whmcs.com/Version_6.1.0_RC_1_Release_Notes

 

You can check out 6.1.0 RC 1 in a dev environment and try it out; this bug is resolved.

 

Once the General Availability is released, you'll be able to upgrade to 6.1 and you won't have to worry about this issue anymore. As stated above, until you upgrade to 6.1, if you make any edits to that template via the admin interface, you'll need to "decode" the data as stored in the database.

Link to comment
Share on other sites

Guest
This topic is now closed to further replies.
×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use & Guidelines and understand your posts will initially be pre-moderated