Jump to content

Email message rendered empty


D9Hosting

Recommended Posts

I'm pulling my hair out with some modifications I'm making to the "Invoice Created" email template.

 

I've added the following code to the template:

 

{if $invoice_payment_method eq "PayPal"}
<br /><br />If you have previously set up a PayPal billing agreement then*{$invoice_total} will be automatically taken from your PayPal account on or around the*{$invoice_date_due}. You can check the status of your billing agreements from within your*<a href="snip">Client Area</a>.*

{elseif*$invoice_payment_method eq "Credit/Debit Card"}
If you have a credit/debit card on file with us then*{$invoice_total} will be automatically taken from your PayPal account on or around the*{$invoice_date_due}.

{else}If you already have an active PayPal subscription set up to pay this invoice, payment will be sent to us by PayPal on or around the invoice due date and no action is required on your part.{/if}

 

But on attempting to send a test email it keeps coming back with:

 

Email Sending Failed - Email message rendered empty - please check the email message Smarty markup syntax

 

So there's obviously something wrong somewhere although it all looks fine to me.

 

If I remove the above code block from the email it works fine.

 

Help!

 

 

Edit: the * after the elseif statement has been added by the forum and isn't present in the actual code

Link to comment
Share on other sites

Hi Brian,

Yeah, I've been doing all the editing via HTML view.

 

The logs are telling me the error is on line 85 due to an unclosed {if} tag, but from what I can see there are only 2 IF statements in there and both have been closed.

 

Entire code below:

 

<table class="body-wrap" style="font-family: 'Helvetica Neue', Helvetica, Arial, sans-serif; box-sizing: border-box; font-size: 14px; width: 100%; background: #f6f6f6; margin: 0;">
<tbody>
<tr style="font-family: 'Helvetica Neue', Helvetica, Arial, sans-serif; box-sizing: border-box; font-size: 14px; margin: 0;">
<td style="font-family: 'Helvetica Neue', Helvetica, Arial, sans-serif; box-sizing: border-box; font-size: 14px; vertical-align: top; margin: 0;" valign="top">*</td>
<td class="container" style="font-family: 'Helvetica Neue', Helvetica, Arial, sans-serif; box-sizing: border-box; font-size: 14px; vertical-align: top; display: block !important; max-width: 600px !important; clear: both !important; margin: 0 auto;" valign="top" width="600">
<div class="content" style="font-family: 'Helvetica Neue', Helvetica, Arial, sans-serif; box-sizing: border-box; font-size: 14px; max-width: 600px; display: block; margin: 0 auto; padding: 20px;">
<table class="main" style="font-family: 'Helvetica Neue', 'Helvetica', 'Arial', sans-serif; box-sizing: border-box; font-size: 14px; border-top-left-radius: 3px; border-top-right-radius: 3px; border-bottom-right-radius: 3px; border-bottom-left-radius: 3px; background-attachment: scroll; background-repeat: repeat; background-image: none; background-position: 0% 0%; background-size: auto; background-origin: padding-box; background-clip: border-box; background-color: #ffffff; width: 100%; border-width: 1px; border-color: #e9e9e9; border-style: solid; margin: 0px;" cellspacing="0" cellpadding="0">
<tbody>
<tr style="font-family: 'Helvetica Neue', Helvetica, Arial, sans-serif; box-sizing: border-box; font-size: 14px; margin: 0;">
<td class="alert alert-warning" style="font-family: 'Helvetica Neue', Helvetica, Arial, sans-serif; box-sizing: border-box; font-size: 16px; vertical-align: top; color: #fff; font-weight: 500; text-align: center; border-radius: 3px 3px 0 0; background: #FF9F00; margin: 0; padding: 20px;" align="center" valign="top">Invoice #{$invoice_num} Created</td>
</tr>
<tr style="font-family: 'Helvetica Neue', Helvetica, Arial, sans-serif; box-sizing: border-box; font-size: 14px; margin: 0;">
<td class="content-wrap" style="font-family: 'Helvetica Neue', Helvetica, Arial, sans-serif; box-sizing: border-box; font-size: 14px; vertical-align: top; margin: 0; padding: 20px;" valign="top">
<table style="font-family: 'Helvetica Neue', 'Helvetica', 'Arial', sans-serif; box-sizing: border-box; font-size: 14px; width: 100%; margin: 0px;" cellspacing="0" cellpadding="0">
<tbody>
<tr style="font-family: 'Helvetica Neue', Helvetica, Arial, sans-serif; box-sizing: border-box; font-size: 14px; margin: 0;">
<td class="content-block" style="font-family: 'Helvetica Neue', Helvetica, Arial, sans-serif; box-sizing: border-box; font-size: 14px; vertical-align: top; margin: 0; padding: 0 0 20px;" valign="top">
<p>Dear {$client_name},</p>
<p>An invoice has been generated on {$invoice_date_created}.</p>
<p>Your payment method is: {$invoice_payment_method}</p>
<p>Invoice #{$invoice_num}<br /> Amount Due: {$invoice_total}<br /> Payment Due By: {$invoice_date_due}</p>
<p><strong>Invoice Items</strong></p>
<p>{$invoice_html_contents} <br /> ------------------------------------------------------</p>
<p>You can make a manual payment on the invoice from within your D9 client area by clicking the link below:</p>
</td>
</tr>
<tr style="font-family: 'Helvetica Neue', Helvetica, Arial, sans-serif; box-sizing: border-box; font-size: 14px; margin: 0;">
<td class="content-block" style="font-family: 'Helvetica Neue', Helvetica, Arial, sans-serif; box-sizing: border-box; font-size: 14px; vertical-align: top; margin: 0; padding: 0 0 20px;" valign="top"><a class="btn-primary" style="font-family: 'Helvetica Neue', Helvetica, Arial, sans-serif; box-sizing: border-box; font-size: 14px; color: #fff; text-decoration: none; line-height: 2; font-weight: bold; text-align: center; cursor: pointer; display: inline-block; border-radius: 5px; text-transform: capitalize; background: #348eda; margin: 0; border-color: #348eda; border-style: solid; border-width: 10px 20px;" href="snip">Click Here To Pay Invoice #{$invoice_num}</a></td>
</tr>
<tr style="font-family: 'Helvetica Neue', Helvetica, Arial, sans-serif; box-sizing: border-box; font-size: 14px; margin: 0;">
<td class="content-block" style="font-family: 'Helvetica Neue', Helvetica, Arial, sans-serif; box-sizing: border-box; font-size: 14px; vertical-align: top; margin: 0; padding: 0 0 20px;" valign="top">
<p>{if strstr($client_credit, "GBP")}If you are a UK resident you can pay via Bank Transfer by using the details below:<br /> <br /> Account Name: D9 Solutions Ltd<br /> Account Number: snip<br /> Sort Code: snip<br /> Reference: {$invoice_num}</p>
<p><em><strong>Please allow 24 hours for Bank Transfer payments to be credited to your account</strong></em>{else}{/if}</p>
{if $invoice_payment_method eq "PayPal"}<br /><br />If you have previously set up a PayPal billing agreement then*{$invoice_total} will be automatically taken from your PayPal account on or around the*{$invoice_date_due}. You can check the status of your billing agreements from within your*<a href="https://d9clients.com/paypalbilling.php">D9 Client Area</a>.*{elseif*$invoice_payment_method eq "Credit/Debit Card"}If you have a credit/debit card on file with us then*{$invoice_total} will be automatically taken from your PayPal account on or around the*{$invoice_date_due}.{else}If you already have an active PayPal subscription set up to pay this invoice, payment will be sent to us by PayPal on or around the invoice due date and no action is required on your part.{/if}
<p>{$signature}</p>
</td>
</tr>
</tbody>
</table>
</td>
</tr>
</tbody>
</table>
<div class="footer" style="font-family: 'Helvetica Neue', Helvetica, Arial, sans-serif; box-sizing: border-box; font-size: 14px; width: 100%; clear: both; color: #999; margin: 0; padding: 20px;">
<table style="font-family: 'Helvetica Neue', 'Helvetica', 'Arial', sans-serif; box-sizing: border-box; font-size: 14px; width: 100%; margin: 0px;">
<tbody>
<tr style="font-family: 'Helvetica Neue', Helvetica, Arial, sans-serif; box-sizing: border-box; font-size: 14px; margin: 0;">
<td class="aligncenter content-block" style="font-family: 'Helvetica Neue', Helvetica, Arial, sans-serif; box-sizing: border-box; font-size: 12px; vertical-align: top; text-align: center; margin: 0; padding: 0 0 20px;" align="center" valign="top"><span class="aligncenter content-block" style="font-family: 'Helvetica Neue', Helvetica, Arial, sans-serif; box-sizing: border-box; font-size: 12px; vertical-align: top; text-align: center; margin: 0; padding: 0 0 20px;">D9 Solutions Limited<br /> OUr address.<br /> Registered in England & Wales. Company Number 06879688.</span></td>
</tr>
</tbody>
</table>
</div>
</div>
</td>
<td style="font-family: 'Helvetica Neue', Helvetica, Arial, sans-serif; box-sizing: border-box; font-size: 14px; vertical-align: top; margin: 0;" valign="top">*</td>
</tr>
</tbody>
</table>

 

As before, those *'s have been added by the forum and aren't present in the actual code.

Link to comment
Share on other sites

those asterisks are bloody annoying when you're trying to debug code - never seen that here before. :mad:

 

if I remove the asterisks and use your code in my invoice created template, it works fine... :roll:

 

there's a redundant {else} (not the one in your new code) but apart from that, the only thing I can see that could cause an issue would be your use of strstr - if you haven't defined it in your Smarty security settings, then it will give an error... though not the one you describe.

 

https://docs.whmcs.com/Smarty_Security_Policy

 

other that that, and if you ignore the asterisks, I don't see any other obvious issues.

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