Jump to content

Updated to 7.10.3 and Cannot Send Emails


Recommended Posts

Recently updated to 7.10.3 (no other customizations or addons/updates) and when I try to generate invoices  from an individual users area, I get this error: "Email Sending Failed - Email message rendered empty - please check the email message Smarty markup syntax". I've never had an issue with sending emails. I do not know if this is for any other users as this is the only one not sending automatically at this time (that I know of).

To get this error here are the steps I'm taking:
-Click the user's name.
-Visit the "Invoices" tab.
-Click on the unpaid invoice number which brings up the invoice. (For some reason the invoice never generated in the runs so I'm sending it manually as it's due April 5th.) 
-Next to the "Invoice Created" box I click "Send Email"
-Error pops up on the top of the screen.

I checked out the https://docs.whmcs.com/Email_Sending_Issues page to try and troubleshoot. 
-the templates are all enabled
-I can see other outgoing emails in the email log
-There are a few other errors at the same time of trying to send the email (screenshot attached). I'm not sure what they mean or what I should do to try and rectify them as nothing has ever been changed other than the update (which was through the dashboard) 

I'm not too sure what to do from here. Can anyone help with this? Thank you in advance. 

Kim

Screenshot 2021-04-02 165302.png

Link to comment
Share on other sites

13 hours ago, kimtown said:

Recently updated to 7.10.3 (no other customizations or addons/updates)

from which version ?

13 hours ago, kimtown said:

I'm not too sure what to do from here. Can anyone help with this? Thank you in advance. 

yggdrasil is right - there is something in the relevant email templates code that it doesn't like... my suspicion is that it's either going to be an invalid character has crept in, or possibly you might now be running foul of the Smarty Security Policy that limits what Smarty / PHP can be used in the email templates.

certainly, if there is some php function (strstr would be an example) being used in an if statement in the template, it won't like it - now {else} is a valid tag, so the chances are whatever it doesn't like is occurring before that tag - so something in those first 13 lines.

I think v8 visibly tells you now if something is breaking the SSP, but I can't recall if v7.10 did or not.

Link to comment
Share on other sites

6 hours ago, brian! said:

from which version ?

I am unsure of that. When the notice pops up in my dashboard that there’s a new version, I just go through the update motions. My best guess would be the previous version to this current one. I am pretty good about updating as soon as they come out. 

Link to comment
Share on other sites

10 hours ago, yggdrasil said:

Did you customize the email templates? The error is telling you there is something wrong in the format or code of your emails.

I’ve not changed anything since the original setup. Perhaps something has triggered it just now in this update? 
I have noticed that the “reminder email” sends with no issues. It just seems to be the initial invoice that will not populate. I’m even more perplexed. So perhaps it’s in the email template just for that initial email? I’ll check that first to be sure. 

Link to comment
Share on other sites

I just double checked the invoice email template and it's the system default template. I've not made any customizations to it. 
Here's what it says:

 

Hello {$client_name},

Your invoice with kimtown Web Design has been generated on {$invoice_date_created}.

Invoice #{$invoice_num}
Amount Due: {$invoice_total}
Due Date: {$invoice_date_due}

If you have a PayPal Subscription setup with this invoice, payment will be taken automatically within the next few days.
{else}

You can also login to your client area to view and pay the invoice at {$invoice_link}.

Here are your login details:

Email Address: {$client_email}
Password: {$client_password}
 

If you need me to reset and send a new password, please feel free to contact me. 

{/if}

 

{$signature}

Link to comment
Share on other sites

15 hours ago, kimtown said:

I am pretty good about updating as soon as they come out. 

but you've intentionally not bothered to update to the v8 or v8.1 releases ? no criticism of that decision, just curious.

15 hours ago, kimtown said:

I just double checked the invoice email template and it's the system default template. I've not made any customizations to it. 

i'm pretty sure the default template for everyone doesn't mention kimtown Web Design! 😎

the most obvious issue is that is no opening {if} statement in that content - you've got an {else} and you're closing the {/if} conditional statement, but there is no opening to it... that will be why WHMCS is confused with the {else} tag and why it thinks it's invalid.

it's probably also worth mentioning that the sending of the client password in the email is basically pointless - it's not going to display the actual password, it's going to show ********* instead.

Link to comment
Share on other sites

4 hours ago, brian! said:

but you've intentionally not bothered to update to the v8 or v8.1 releases ? no criticism of that decision, just curious.

4 hours ago, brian! said:

 

I have no notice to update in my dashboard. When I visit my dashboard it tells me I’m updated to the latest version so I’m not sure what you mean there. 
 

 

Link to comment
Share on other sites

4 hours ago, brian! said:

i'm pretty sure the default template for everyone doesn't mention kimtown Web Design! 😎

 

I have not customized the template at all. I can see which templates I’ve customized. It tells me by the red “custom” buttons. 
I assume that’s an auto populated field that comes from my setup. 

Link to comment
Share on other sites

1 hour ago, kimtown said:

I have not customized the template at all. I can see which templates I’ve customized. It tells me by the red “custom” buttons. 
I assume that’s an auto populated field that comes from my setup. 

Check the source code for that template email. It definitely does look like you customized it someway. Attach the full file here.

You can see the source code by disabling the Rich Text Editor or clicking on <> on it to see the source code.

Link to comment
Share on other sites

1 hour ago, kimtown said:

I have not customized the template at all. I can see which templates I’ve customized. It tells me by the red “custom” buttons. 
I assume that’s an auto populated field that comes from my setup. 

You must have. This is the default:
 

Dear {$client_name},

This is a notice that an invoice has been generated on {$invoice_date_created}.

Your payment method is: {$invoice_payment_method}

Invoice #{$invoice_num}
Amount Due: {$invoice_total}
Due Date: {$invoice_date_due}

Invoice Items

{$invoice_html_contents}
------------------------------------------------------

You can login to your client area to view and pay the invoice at {$invoice_link}

{$signature}

No mention of company or any conditionals (if/else). What Brian said is likely correct, that you'd had some conditional at some point, and it was edited incorrectly. 

As for the red "custom" icon? Those are templates you've created, not default ones that were modified.

Edited by bear
Link to comment
Share on other sites

3 hours ago, bear said:

You must have. This is the default:
 


Dear {$client_name},

This is a notice that an invoice has been generated on {$invoice_date_created}.

Your payment method is: {$invoice_payment_method}

Invoice #{$invoice_num}
Amount Due: {$invoice_total}
Due Date: {$invoice_date_due}

Invoice Items

{$invoice_html_contents}
------------------------------------------------------

You can login to your client area to view and pay the invoice at {$invoice_link}

{$signature}

No mention of company or any conditionals (if/else). What Brian said is likely correct, that you'd had some conditional at some point, and it was edited incorrectly. 

As for the red "custom" icon? Those are templates you've created, not default ones that were modified.

Perhaps the default has changed over many years. I have never changed the default invoice email template as I would have no reason to. I also would not add an "if" or an "else" randomly in a template for an invoice email if I did. That seems oddly off.

I'm going to assume at some point in the WHMCS upgrades the original template has changed and it didn't properly upgrade and remove any errant elses or ifs and this is where we are. I've had this software for many many years and rarely had any issues. 

I will update the template removing the errant else and if in hopes it will fix the error and not throw further issues.

Thank you for the information regarding the icons, I was not aware of that. I appreciate all of the help you've provided thus far. 

Link to comment
Share on other sites

1 hour ago, kimtown said:

I'm going to assume at some point in the WHMCS upgrades the original template has changed

Just had a look in WHMCS 4.5.2.
 

Dear [CustomerName], 
This is a notice that an invoice has been generated on [InvoiceDate].
Your payment method is: [PaymentMethod]
Invoice #[InvoiceNo]
Amount Due: [AmountDue]
Due Date: [DueDate]
<strong>Invoice Items</strong>
[Description] <br />
------------------------------------------------------
You can login to your client area to view and pay the invoice at [InvoiceLink]
[Signature]

That's from the db insert statement in that download. Since that matches the one in the 8.13 download, I'd suggest that the changes that included, then removed, the if/else were likely done only on your installation. In none of the versions I have here is there a company name in the template. If you didn't change it, you might ask those you work/worked with about it, and check the others also, just to be sure they're all correct.

Link to comment
Share on other sites

20 minutes ago, bear said:

Just had a look in WHMCS 4.5.2.
 


Dear [CustomerName], 
This is a notice that an invoice has been generated on [InvoiceDate].
Your payment method is: [PaymentMethod]
Invoice #[InvoiceNo]
Amount Due: [AmountDue]
Due Date: [DueDate]
<strong>Invoice Items</strong>
[Description] <br />
------------------------------------------------------
You can login to your client area to view and pay the invoice at [InvoiceLink]
[Signature]

That's from the db insert statement in that download. Since that matches the one in the 8.13 download, I'd suggest that the changes that included, then removed, the if/else were likely done only on your installation. In none of the versions I have here is there a company name in the template. If you didn't change it, you might ask those you work/worked with about it, and check the others also, just to be sure they're all correct.

Welp then call me stumped. I am not a programmer so I don't work with else/if statements and I wouldn't have put them in the template, nor anyone that works for me. I removed them so I'm crossing fingers and toes that it fixed the issue. Again, thank you for taking your time to help me out. 

Link to comment
Share on other sites

18 hours ago, kimtown said:

I have no notice to update in my dashboard. When I visit my dashboard it tells me I’m updated to the latest version so I’m not sure what you mean there. 

https://blog.whmcs.com/133668/whmcs-81-now-available

there have been around 10 newer releases since v7.10.2 (v7.10.3 is just a security update) - v8.0 and v8.1 have both been released in the last year.

if you're happy with v7.10, then I wouldn't necessarily rush to update to v8 or later without testing those newer releases first before updating a production server... though be aware that v7.10 is supposed to enter End Of Life status at the end of this month (April 2021).

18 hours ago, kimtown said:

I have not customized the template at all. I can see which templates I’ve customized. It tells me by the red “custom” buttons. 

if you "customise" an existing template, e.g just changing text, adding Smarty code etc, then that wouldn't be signified by the red custom buttons - as bear says, the templates with those red buttons just signify that they are *new* templates created by you and not one of the default ones.

it might be worth searching through the logs to see when these errors started to occur - that might give you a clue as to how/when it happened.

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • 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