Answers.Body: <p>Using the browser network tools shows a failure to load the template with a &quot;mixed content&quot; message.  The problem is that the template metadata includes the full URL of the template.</p>
  <p>The fix is to update the template URL in the Mosaico metadata to use https:// in place of http://</p>
  <p>With db access, you can update <code>template_options</code> in <code>civicrm_mailing</code>.</p>
  <p>Alternatively, start from <code>cv api Mailing.get id=...</code></p>
  <h2>Update</h2>
  <p>There is now an API call to update the templates for you.  See <a href="https://docs.civicrm.org/mosaico/en/latest/#migration-to-a-new-domain" rel="nofollow noreferrer">the docs</a></p>
  <pre><code>cv api MosaicoTemplate.replaceurls from_url=&quot;http://old.server.org&quot; to_url=&quot;https://new.server.org&quot;
  </code></pre>
  
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2019-08-29T14:34:25.020Z
Answers.LastActivityDate: 2020-12-18T19:06:31.027Z
Answers.LastEditDate: 2020-12-18T19:06:31.027Z
Answers.UserDisplayName: Aidan
Answers.Body: <p>I had the same issue when creating a new mailing when I migrated a site from Drupal to WordPress, so obviously the path changed. Correcting the path in the Metadata field in the civicrm_mosaico_template table fixed it for me. However, to be able to reuse old mailings, I did have to use the method above.</p>
  
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2022-03-01T23:11:15.580Z
Answers.LastActivityDate: 2022-03-02T00:07:11.017Z
Answers.LastEditDate: 2022-03-02T00:07:11.017Z
Answers.UserDisplayName: guyiac
Answers.Body: <p>If you change your site's domain, the specific sql that you can run to fix your templates and (separately) your existing messages (e.g. those in progress or in case you want to copy them):</p>
  
  <p>From "olddomain.org" to "newdomain.org":</p>
  
  <pre><code>update civicrm_mosaico_template set metadata = replace(metadata,'olddomain.org','newdomain.org');
  update civicrm_mailing set template_options = replace(template_options,'olddomain.org','newdomain.org');
  </code></pre>
  
  <p>If your old/new domains share some parts (e.g. you're going from domain.org to www.domain.org) you'll want to be careful not to run it more than once and it may mess up something else.</p>
  
  <p>If you're also changing the protocol (http to https), then it's a bit tricky because the template_options field is in json notation with "/" escaped. You could do it in a separate step, replacing 'http' with 'https' for example.</p>
  
  <p>There's an open issue here: <a href="https://github.com/veda-consulting/uk.co.vedaconsulting.mosaico/issues/87" rel="nofollow noreferrer">https://github.com/veda-consulting/uk.co.vedaconsulting.mosaico/issues/87</a> to try and fix it.</p>
  
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2021-07-19T15:41:25.787Z
Answers.Text: If you're using this to update the path (i.e. if you've moved the location of your extension) then you'll need to know that the paths are being escaped with backslashes in the json in the db, and the mysql replace function handles backslashes in a confusing and badly documented way. My cheatsheet summary is: use double backslashes in the from, no escaping in the to, e.g. 
  update civicrm_mailing set template_options = replace(template_options,'\\/vendor\\/uk.co.vedaconsulting.mosaico','\/sites\/default\/files\/civicrm\/ext\/uk.co.vedaconsulting.mosaico');
Answers.UserDisplayName: Alan Dixon
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2019-11-06T15:18:09.757Z
Answers.LastActivityDate: 2019-11-06T15:18:09.757Z
Answers.UserDisplayName: Alan Dixon
Body: <p>When attempting to reuse a mail, things work normally until clicking 'Edit' which results in a mostly blank page - some of the Mosaico page is shown but not the content.</p>
  
  <p>What turns out to be important is that the site recently moved from using http:// to https://</p>
  
Comments.ContentLicense: CC BY-SA 4.0
Comments.CreationDate: 2019-11-06T15:19:08.060Z
Comments.Text: I've answered a more general version of your question below.
Comments.UserDisplayName: Alan Dixon
Tags: <civimail><mosaico>
Title: Blank screen when reusing a previous mail (Mosaico)
ThreadText: # Blank screen when reusing a previous mail (Mosaico)
  
  (Asked by: username_0 on 2019-08-29)
  
  When attempting to reuse a mail, things work normally until clicking 'Edit' which results in a mostly blank page - some of the Mosaico page is shown but not the content.
  
  What turns out to be important is that the site recently moved from using http:// to https://
  
  **Tags:** civimail, mosaico
  
  > **Comments:**
  > **username_1**: I've answered a more general version of your question below.  
  
  ---
  
  ## 3 answers
  
  ### Answer by username_1 on 2019-11-06. Score: 4 | Accepted answer
  
  If you change your site's domain, the specific sql that you can run to fix your templates and (separately) your existing messages (e.g. those in progress or in case you want to copy them):
  From "olddomain.org" to "newdomain.org":
  update civicrm_mosaico_template set metadata = replace(metadata,'olddomain.org','newdomain.org');
  update civicrm_mailing set template_options = replace(template_options,'olddomain.org','newdomain.org');
  
  If your old/new domains share some parts (e.g. you're going from domain.org to www.domain.org) you'll want to be careful not to run it more than once and it may mess up something else.
  If you're also changing the protocol (http to https), then it's a bit tricky because the template_options field is in json notation with "/" escaped. You could do it in a separate step, replacing 'http' with 'https' for example.
  There's an open issue here: https://github.com/veda-consulting/uk.co.vedaconsulting.mosaico/issues/87 to try and fix it.
  
  > **Comments:**
  > **username_1**: If you're using this to update the path (i.e. if you've moved the location of your extension) then you'll need to know that the paths are being escaped with backslashes in the json in the db, and the mysql replace function handles backslashes in a confusing and badly documented way. My cheatsheet summary is: use double backslashes in the from, no escaping in the to, e.g.  update civicrm_mailing set template_options = replace(template_options,'\\/vendor\\/uk.co.vedaconsulting.mosaico','\/sites\/default\/files\/civicrm\/ext\/uk.co.vedaconsulting.mosaico');  
  
  ---
  
  ### Answer by username_0 on 2019-08-29. Score: 4
  
  Using the browser network tools shows a failure to load the template with a "mixed content" message.  The problem is that the template metadata includes the full URL of the template.
  The fix is to update the template URL in the Mosaico metadata to use https:// in place of http://
  With db access, you can update template_options in civicrm_mailing.
  Alternatively, start from cv api Mailing.get id=...
  Update
  There is now an API call to update the templates for you.  See the docs
  cv api MosaicoTemplate.replaceurls from_url="http://old.server.org" to_url="https://new.server.org"
  
  
  ---
  
  ### Answer by username_2 on 2022-03-01. Score: 0
  
  I had the same issue when creating a new mailing when I migrated a site from Drupal to WordPress, so obviously the path changed. Correcting the path in the Metadata field in the civicrm\_mosaico\_template table fixed it for me. However, to be able to reuse old mailings, I did have to use the method above.
  
  
  ---
  
  