Email Templates - impossible to use

Hello everyone,

Despite all attempts to create an email template from a custom HTML code (which works fine in Edge, IE, Firefox and Chrome), the template is seen wrong in the preview tab, than the CRM crashes on save and that’s the end of the story. Frustration is hitting the roof now, as we have all our customers in CRM and cannot send newsletters.

I am using Version 7.9.4. Mail notification are working, creating a template with the Mosaic editor works, but the custom HTML is still not accepted… Note that I’ve created the code without styles, just to make sure is compatible. PM for the HTML file.

Any help would be appreciated, including taking a look under the hood of the SuiteCRM.

Hi

do you see any errors in your logs at the time of the failure?

Hello,
Meanwhile I’ve discovered why it crashes:
An error occurred translating the query string to UTF-16: No mapping for the Unicode character exists in the target multi-byte code page.

So it simply cannot understand special characters like “ș, ț. î. ă” which we heavily use in our language, Romanian.

Aside from that, I;ve tried my HTML code in Mailchimp and Sendinblue, and workd perfectly. Not in SuiteCRM…

That’s probably a bug that still needs to be fixed.

Any error messages that you can find in your logs would really help.

And if you can also provide a detailed lists of “steps to reproduce” the bug, where you click, exactly which text you enter, etc., that would be helpful.

Well, New Email Template, than Add a headline, write a special character like “Ț” than save template = crash.
Also, the width of the Template does not stay as defined. But this is more random.

And, the main issue, the code is rewritten and is not accepted as all other aplications do. A prefectly good HTML template is transformed into a mumbo-jumbo of tags and redundant paragraphs and so on…

Aaand, despite trying to remove the special characters:

.
08/28/17 14:50:02 [1692][1][FATAL] Exception handling in C:\inetpub\wwwroot\include\MVC\Controller\SugarController.php:397
08/28/17 14:50:02 [1692][1][FATAL] Exception in Controller: Database failure. Please refer to suitecrm.log for details.
08/28/17 14:50:02 [1692][1][FATAL] backtrace:
#0 C:\inetpub\wwwroot\include\database\DBManager.php(345): sugar_die(‘Database failur…’)
#1 C:\inetpub\wwwroot\include\database\DBManager.php(321): DBManager->registerError(‘Error inserting…’, ‘An error occurr…’, true)
#2 C:\inetpub\wwwroot\include\database\SqlsrvManager.php(227): DBManager->checkError(‘Error inserting…’, true)
#3 C:\inetpub\wwwroot\include\database\DBManager.php(496): SqlsrvManager->query(‘INSERT INTO ema…’, true, ‘Error inserting…’)
#4 C:\inetpub\wwwroot\data\SugarBean.php(2054): DBManager->insert(Object(EmailTemplate))
#5 C:\inetpub\wwwroot\modules\EmailTemplates\EmailTemplate.php(853): SugarBean->save(false)
#6 C:\inetpub\wwwroot\modules\EmailTemplates\EmailTemplateFormBase.php(231): EmailTemplate->save(false)
#7 C:\inetpub\wwwroot\modules\EmailTemplates\EmailTemplateFormBase.php(170): EmailTemplateFormBase->processImages(Object(EmailTemplate), true, ‘download’, false)
#8 C:\inetpub\wwwroot\modules\EmailTemplates\EmailTemplateFormBase.php(165): EmailTemplateFormBase->handleAttachmentsProcessImages(Object(EmailTemplate), true, true, ‘download’, false)
#9 C:\inetpub\wwwroot\modules\EmailTemplates\Save.php(70): EmailTemplateFormBase->handleSave(’’, true, false, true, ‘download’)
#10 C:\inetpub\wwwroot\include\MVC\View\SugarView.php(791): include_once(‘C:\inetpub\wwwr…’)
#11 C:\inetpub\wwwroot\include\MVC\View\views\view.classic.php(74): SugarView->includeClassicFile(‘modules/EmailTe…’)
#12 C:\inetpub\wwwroot\include\MVC\View\SugarView.php(199): ViewClassic->display()
#13 C:\inetpub\wwwroot\include\MVC\Controller\SugarController.php(427): SugarView->process()
#14 C:\inetpub\wwwroot\include\MVC\Controller\SugarController.php(370): SugarController->processView()
#15 C:\inetpub\wwwroot\include\MVC\SugarApplication.php(105): SugarController->execute()
#16 C:\inetpub\wwwroot\index.php(52): SugarApplication->execute()
#17 {main}
08/28/17 14:50:06 [652][1][ERROR] Unable to load custom logic file: custom/include/social/hooks.php

OH, and there is no suitecrm.log.

I tried the issue on the online demo and there is no crash, although the special character does not appear correctly.

Don’t be surprised that SuiteCRM changes your HTML, there have to be some security validations and some encodings to save it in the database. The only problem is that there seems to be some bug that is messing up these necessary operations.

We need to make sure your permissions are set correctly.

  1. Please tell me if this is a new install?

  2. Windows or Linux? Which version of database, web server and PHP?

  3. If you have SSH access to a shell, can you please post here the results of this command given from your SuiteCRM root directory?

ls -al
  1. Very old install, more than 10 years ago, upgraded succesively to the current version
  2. The CRM runs in a VM with Windows 2008 R2 Server, SQL Server 2005, IIS7, PHP5.3 - many custom fields in the database.
    So far, is working good, except the Campaign - email module, which is not really working since the Mozaik thing
    3.If SSH is absolutely necessary, I will install OpenSSH and modify the firewall…

Thanks!

The main problem I see there is PHP 5.3, which is not covered by the compatibility matrix for SuiteCRM 7.9.4.

It this is an old install, and is on Windows, then I don’t think the problems are permissions-related after all.

I had found the absence of a suitecrm.log very suspicious, but maybe you you come from SugarCRM and your log is called sugarcrm.log? See what you find in there…

The PHP problem is real, it can break many things in the code. If you are in a VM I would just try creating a Checkpoint (in case anything goes wrong) and do a PHP upgrade (all the way to 7.0, why not?). Then see how things work.

After upgrading to PHP 7.0.21 , SuiteCRM seems to call a function that was already deprecated in PHP7:

[28-Aug-2017 18:37:41 Asia/Muscat] PHP Fatal error: Uncaught Error: Call to undefined function mssql_pconnect() in C:\inetpub\wwwroot\include\database\MssqlManager.php:198

Stack trace:
#0 C:\inetpub\wwwroot\include\database\DBManagerFactory.php(144): MssqlManager->connect(Array, true)
#1 C:\inetpub\wwwroot\include\entryPoint.php(179): DBManagerFactory::getInstance()
#2 C:\inetpub\wwwroot\index.php(47): require_once(‘C:\inetpub\wwwr…’)
#3 {main} thrown in C:\inetpub\wwwroot\include\database\MssqlManager.php on line 198

On line 198 we have:
$this->database = @mssql_pconnect(

but the function is used in all the MssqlManager.php file. So it seems to me that SuiteCRM is not quite ready for PHP 7… Or maybe I’m doing something wrong.
And when you think that all I want is to send some campaigns…

The code is like this:

https://github.com/salesagility/SuiteCRM/blob/8b386259cf0e6123f7ba6d27a4aab32d81c19bd0/include/database/MssqlManager.php#L196-L210

So it seems it’s dependent on an option called “persistent”. This can be a setting in your config.php or config_override.php, can you check that, please?

Please note that SuiteCRM is not as tested on Windows since most people use it in Linux. And the combination of Windows + PHP 7.0 is recent, so…

Indeed. this is the code.

In config.php I do have this line:

array (
‘persistent’ => true,

Unfortunately I have zero knowledge of PHP, so I have no idea what to do next.
Thanks!

Well, try changing that ‘true’ to ‘false’ and see what happens.

MSSql will connect with the other command. I don’t really know what that means, so you might want to look into it.

But I don’t think it will break anything, maybe it can have some impact in performance, maybe not.

Good luck

OK, changed to false. Sugar still working
Changed to PHP 7. HTTP Error 500.

[28-Aug-2017 19:29:31 Asia/Muscat] PHP Fatal error: Uncaught Error: Call to undefined function mssql_connect() in C:\inetpub\wwwroot\include\database\MssqlManager.php:206
Stack trace:
#0 C:\inetpub\wwwroot\include\database\DBManagerFactory.php(144): MssqlManager->connect(Array, true)
#1 C:\inetpub\wwwroot\include\entryPoint.php(179): DBManagerFactory::getInstance()
#2 C:\inetpub\wwwroot\index.php(47): require_once(‘C:\inetpub\wwwr…’)
#3 {main}
thrown in C:\inetpub\wwwroot\include\database\MssqlManager.php on line 206

Have the feeling that this is too early for PHP7 :slight_smile:

I would say you need to enable Mssql in your php.ini otherwise PHP doesn’t know how to talk to your database. Basically I don’t believe your PHP upgrade is complete. Some configuration is still needed.

I’m afraid I don’t know exactly how to help you, but there should many pages you can Google explaining it.

If it’s a missing PHP package, remember to put back the “persistent” setting to ‘true’, we don’t need to change if it’s not the problem.