Errors after sending quote email template

So I added a template for my quote emails, which worked out fine, but when I choose the template when sending the quote (without adding something to the content window), it gives me the following errors:

A PHP Error was encountered

Severity: Warning

Message: unlink(example/uploads/temp/mpdf): Is a directory

Filename: helpers/mpdf_helper.php

Line Number: 131


File: /example/application/helpers/mpdf_helper.php
Line: 131
Function: unlink

File: /example/application/helpers/pdf_helper.php
Line: 254
Function: pdf_create

File: /example//helpers/mailer_helper.php
Line: 92
Function: generate_quote_pdf

File: /example/application/modules/mailer/controllers/Mailer.php
Line: 208
Function: email_quote

File: /example/public_html/efact/index.php
Line: 327
Function: require_once

A PHP Error was encountered

Severity: Warning

Message: escapeshellcmd() has been disabled for security reasons

Filename: phpmailer/class.phpmailer.php

Line Number: 1442


File: /example/vendor/phpmailer/phpmailer/class.phpmailer.php
Line: 1442
Function: escapeshellcmd

File: /example/vendor/phpmailer/phpmailer/class.phpmailer.php
Line: 1485
Function: isShellSafe

File: /example/efact/vendor/phpmailer/phpmailer/class.phpmailer.php
Line: 1337
Function: mailSend

File: /example/vendor/phpmailer/phpmailer/class.phpmailer.php
Line: 1213
Function: postSend

File: /example/application/modules/mailer/helpers/phpmailer_helper.php
Line: 139
Function: send

File: /example/application/helpers/mailer_helper.php
Line: 104
Function: phpmail_send

File: /example/application/modules/mailer/controllers/Mailer.php
Line: 208
Function: email_quote

File: /example/public_html/efact/index.php
Line: 327
Function: require_once

A PHP Error was encountered

Severity: Warning

Message: Cannot modify header information - headers already sent by (output started at /example/vendor/codeigniter/framework/system/core/Exceptions.php:271)

Filename: helpers/url_helper.php

Line Number: 564


File: /example/efact/application/modules/mailer/controllers/Mailer.php
Line: 213
Function: redirect

File: /example/public_html/efact/index.php
Line: 327
Function: require_once

I get the same errors when I just add the HTML in the content window, without selecting the template.

Your help would be much appreciated :smiley:


Could you post an example of the HTML you are trying to use please? I suspect something simple in your signature is causing the script to terminate early.

Also - you should probably edit your first post to sanitize some of your paths; you are disclosing much more than you should! at the very least, change your domain names to “

Thanks for the security comment, didn’t really think of that :sweat_smile:

Also, the example would be a tad too long, since it’s an entire HTML email template (I designed and coded the whole thing like an HTML newsletter). I’ll send it in PM.

Remember your template is for HTML <body>! Your code is not e-mail friendly! You are also using tags which are not universal (e.g. <title> is valid W3-HTML, but not valid e-mail HTML)! Whilst it will work from within a mail client, it is possible that the tags can conflict with the code inside applications. Mail clients will ignore the code it doesn’t need; webapps will digest it.

Also, you have conditional statements hidden within HTML comment tags (valid W3 backwards compatibility for static HTML), however you are placing those tags within a PHP webapp. To immediately rule out both of these, try the following:

  1. Remove the <HTML> and <HEAD> sections of code (and their closing tags); these are applied by default by Invoiceplane. If that doesn’t work,
  2. Try using a “basic” template, utilising inner HTML only, at the most basic level. You are not creating a complete HTML document - you are creating HTML body. Stick to the really simple, like some <p>, <a> and <strong> blocks. If this works, try:
  3. Add some CSS related content.

If 2 and 3 work, re-examine your body text for punctuation (e.g. use &quot; and not " ), and test other things one at a time, such as <!--[if !mso]><!--> to see what finally breaks things :).

Hey Twoup, I’ve been working with email templates professionally for almost 2 years fulltime, so I’m pretty sure it’s email friendly. Thanks for the critical review though :blush:

However, it could be that my code isn’t Invoiceplane email friendly :sweat_smile: since there are (like you mentioned) conditional comments and all sorts of things in there that it might not parse.

Anyhow, I can’t remove the head part of the html, it is quite fundamental for a good email. If this webapp only supports parts, I’d have to do something else about it then :smiley: It would’ve been nice to be completely free to write your own code while using the InvoicePlane variables. Will try further before I write it off though! :blush:

It’s not a critical review, it’s a statement of fact. I’ve been providing hosting, infrastructure, design and development services since 1995, long before HTML was even thought of for emails. You have non universal HTML in your template, such as . There are others in there too, however I i

I shall simplify my previous suggestion. When you are trying something new, Keep It Simple. Don’t blast in there 750 lines of code. If you encounter a problem, try something simple and add complexity. And when people give you a polite heads up and basic troubleshooting steps to try to get to the bottom of your issue, remember they’ve possibly got 20 years more professional experience that they are drawing upon.

InvoicePlane is a very customisable Invoice and Quotation system, it is not a rich mail system or marketing mailer, But it is the best Open Source solution for Invoices and Quotes.

It can also produce decent results in terms of email formatting if you understand how to code in the version of HTML widely adopted in Email, and that’s not MSXML or HTML5 based. There are roughly 26 universally accepted HTML tags for email, and roughly 46 universally accepted CSS tags. If you are going beyond that, you are producing bloated code that was never intended for email, just like Outlook. It’s HTML capabilities use more than universal HTML too, much of which is discarded by non-Outlook mail clients.

Well, I just meant you’re being critical towards my code in this context, please don’t take it personal. I’m really thankful for your help.

I know what you meant with your reply. I also wouldn’t use Outlook to send complex mails though :blush: I mean, if an app isn’t meant for such a complex task atm, then you’ve got 2 choices, I guess. Either live with it and adapt your code to a simpeler version or change the app so that it can deal with the complexity. I just prefer the latter ^^

Indeed you would have to adapt your templates and wait for for the Email Template implementation that supports full-HTML emails including the head (which is already planned but kinda huge feature that takes a lot of time to develop).

Sounds very promising. Looking forward to it!

My apologies for how my reply read. There was no offence taken or meant :slightly_smiling_face:. I was merely imparting my experience :slight_smile: of changes in ‘the Internet’; perhaps I’ve seen too much! I’m now the old it geek who sits in the corner groaning :frowning: lol!

The deprecations in PHP7 are a prime example of change / impact; it has taken about 7 years to remove mysql_connect in favour of PDO and MySQLi; even then, some places are still not ready!

There has never been a formal ‘HTML email standard’, and the main supported commands mirror the functionality of Rich Text. Outlook is the best example of the lack of standards, most of what it sends is nothing but pointless traffic to most other clients. It is also the most accepting client, as it covers most current HTML standards. It all adds bulk to the amount of data transported across the internet, and SMTP isn’t really designed to handle a lot of data in one go. It should be possible to create your chosen effect using external calls, but that can also be problematic and time consuming.

Fortunately, @Kovah and the devs are on it, but I dont envy their task. Ultimately, they will be adding another potential schema to the mix until someone comes up with a unified standard :frowning:.

Hi there,

Don’t know if this helps or not, but I had the same issue with a 1.5.4 fresh installation.

I solved it modifying mpdf_helper.php line 129 to replace !is_dir( $file) with !is_dir(UPLOADS_FOLDER . ‘temp/’ . $file).

Mentionning the full path made the trick.

Hope this helps.

1 Like