Page MenuHomePhabricator

Email Templates Not Populating
Closed, ResolvedPublic2 Story Points


I just tried emailing an individual with an email template, but none of the templates appear to populate to review and edit before sending over to the individual. I tested the "send email" button on my own Civi record and received the email, but the ability to view what I was sending beforehand wasn't there.

Event Timeline

LeanneS created this task.Oct 30 2015, 5:45 PM
LeanneS raised the priority of this task from to Needs Triage.
LeanneS updated the task description. (Show Details)
LeanneS added a subscriber: LeanneS.
Restricted Application added a subscriber: Aklapper. · View Herald TranscriptOct 30 2015, 5:45 PM
awight added a subscriber: awight.Oct 30 2015, 5:51 PM

Please document the steps to reproduce this bug, when you have the chance.

I'm seeing the preview, following these steps:

  • View my own contact record.
  • Click the Actions button.
  • Choose Send an Email
  • Try different Use Template choices.

The preview field does contain the message body for me. It's a little annoying that you can't preview the token replacement, you just see the variable name instead, like {contact.first_name}.

@awight those are the same steps I took, but no message was appearing on my end. I just tried again and clicked on Plain-Text Format, and then was able to see the template. This is a separate step that wasn't in old Civi as it would always appear, but now I know!

The templates that I tried using were the 3 with "2014/15 Benefactor Email" in the name.

Noting that the template content is retrieved using a JS call to /civicrm/ajax/template, so we should look for errors there.

I watched the weblog during some of these requests--we used "FY2014/15 Benefactor Email ($1K+)". On LeanneS's computer, nothing appeared in the HTML message preview, but plaintext was populated. On my computer, both previews worked. In each of our cases, the POST to the template backend was an HTTP status 200 and returned the same number of bytes, 1608.

Must be a JS problem? Safari/537.36

LeanneS triaged this task as Unbreak Now! priority.Nov 2 2015, 7:35 PM
LeanneS set Security to None.

Tried editing the plaintext version as a quick fix. The email sent, but the edits made weren't reflected.

I tried replicating this and I succeeded in doing so using safari (but not chrome).

Note that with safari I did NOT get the error if I chose to open the link in a new tab (or at least the html loaded correctly). This might provide an interim work-around


[Error] Failed to load resource: the server responded with a status of 404 (Not Found) (;, line 0)
[Error] Failed to load resource: the server responded with a status of 403 (Forbidden) (jquery-fieldselection.js, line 0)
[Error] SyntaxError: Unexpected identifier 'authorized'
(anonymous function)
(anonymous function)
[Error] ReferenceError: Can't find variable: selectValue

I'm seeing a particular resources is getting a forbidden in Safari in the pop up but not with other browsers / safari with no pop up

[Error] Failed to load resource: the server responded with a status of 403 (Forbidden) (jquery-fieldselection.js, line 0)

OK - I also found that if I force-loaded the js outside of the pop-up window it then worked in the pop-up (cached I assume) - The js is jquery/plugins/jquery-fieldselection.js?_=1446497122349

So, this error occurs in the presence of 3 factors

  1. Safari browser
  2. Requirement for client side SSL client certificate
  3. Pop-up window.

Both 1 & 3 of these can be avoided, by either not using safari or choosing to open the link in a new tab rather than the normal click with gives a pop-up.

It's also possible to get 1-3 working if you first open the js file in your browser, causing it to be cached. But I expect that will expire out.

In terms of what is going on I think that because the js file has a different path to the main civicrm code it is being asked to renegotiate the ssl connection when it attempts to access it and in the pop-up that fails due to a Safari bug. It seems possible to alter the apache config such that it won't have to renegotiate per comments in this thread (but that is a change that would need to involve ops):

It seems like the web browser is rejecting the server's attempt at SSL

renegotiation. I suggest trying to avoid this problem by configuring the
web server so that it does not request SSL renegotiation.
Apache HTTP Server will request SSL renegotiation any time an SSL session is
already established but a request is made for a per-location context which
requires different security -- for example, if you have the SSLVerifyClient
directive in a Directory or Location block.
If you determine this to be the problem, a solution is to move the
SSLVerifyClient directive "up" so that it is in the VirtualHost context and
applies to the entire vhost. This way, the client certificate will be
verified for all connections, regardless of what URI path the client
requests, and SSL renegotiation will not be triggered for some client

Note the path is sites/all/modules/civicrm/packages/jquery/plugins/jquery-fieldselection.js?_=1446496141609 - so that path is not under 'civicrm' standard path

Adding tech-ops now that Apache config is in question...

Also, @LeanneS
Please let us know if Eileen's workarounds help you, and we'll lower the priority if so.

We messed around with a bunch of things, and the only workaround that worked for LeanneS was to use Firefox.

Chrome throws a JavaScript exception about "Uncaught TypeError: Cannot read property 'textColorTitle' of undefined" from ckeditor.js, and none of the edit fields work.

awight lowered the priority of this task from Unbreak Now! to High.Nov 2 2015, 11:48 PM

Taking priority down a notch, now that we have a viable workaround.

@Eileenmcnaughton was right--this is just a caching issue. We noticed that everything worked fine on the staging server, went back to the production server and cleared cached files. Works!

awight edited a custom field.Nov 4 2015, 11:50 PM
DStrine assigned this task to awight.Nov 6 2015, 9:19 PM
CaitVirtue closed this task as Resolved.Nov 30 2015, 10:21 PM
CaitVirtue added a subscriber: CaitVirtue.
mmodell removed a subscriber: awight.Jun 22 2017, 9:43 PM