# Can't load New Template Email

**URL:** <https://forum.mautic.org/t/cant-load-new-template-email/18884>\
**Category:** Product Support\
**Created:** [April 6, 2021, 5:43pm UTC](https://forum.mautic.org/t/cant-load-new-template-email/18884 "2021-04-06T17:43:13Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![anei](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.mautic.org/anei/32/1129_2.png) [@anei](https://forum.mautic.org/u/anei)\
**Post date:** [April 6, 2021, 5:43pm UTC](https://forum.mautic.org/t/cant-load-new-template-email/18884/1 "2021-04-06T17:43:13Z")

</div>

**Your software**  
My Mautic version is: 3.3.2  
My PHP version is: 7.4.16  
My Database type and version is: 10.2.37-MariaDB  
My OS: Centos 7

**Your problem**  
My problem is: When I’m trying to load new template email I get blank page.

These errors are showing in the log:  
[2021-04-06 18:32:53] mautic.CRITICAL: Uncaught PHP Exception RuntimeException: “Unable to write in the cache directory (/var/www/html/app/…/var/tmp/twig/2d).” at /var/www/html/vendor/twig/twig/src/Cache/FilesystemCache.php line 61 {“exception”:"[object] (RuntimeException(code: 0): Unable to write in the cache directory (/var/www/html/app/…/var/tmp/twig/2d). at /var/www/html/vendor/twig/twig/src/Cache/FilesystemCache.php:61)"}

Steps I have tried to fix the problem:  
I tried to restore/setup file permission but nothing changed.

`sudo chown -R apache:apache /var/www/html/var/tmp/`  
`chcon -t httpd_sys_content_rw_t /var/www/matomo/tmp`

Thank you!

---

<div class="post-metadata">

**Author:** ![anei](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.mautic.org/anei/32/1129_2.png) [@anei](https://forum.mautic.org/u/anei)\
**Post date:** [April 7, 2021, 11:04am UTC](https://forum.mautic.org/t/cant-load-new-template-email/18884/2 "2021-04-07T11:04:28Z")

</div>

I tried to set all the permissions to apache user but I still get this:

[2021-04-07 12:09:08] mautic.CRITICAL: Uncaught PHP Exception RuntimeException: “Unable to write in the cache directory (/var/www/html/app/…/var/tmp/twig/02).” at /var/www/html/vendor/twig/twig/src/Cache/FilesystemCache.php line 61 {“exception”:"[object] (RuntimeException(code: 0): Unable to write in the cache directory (/var/www/html/app/…/var/tmp/twig/02). at /var/www/html/vendor/twig/twig/src/Cache/FilesystemCache.php:61)"}

Can someone help?  
Thank you!

---

<div class="post-metadata">

**Author:** ![anei](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.mautic.org/anei/32/1129_2.png) [@anei](https://forum.mautic.org/u/anei)\
**Post date:** [April 7, 2021, 11:51am UTC](https://forum.mautic.org/t/cant-load-new-template-email/18884/3 "2021-04-07T11:51:08Z")

</div>

Here is the solution: [CentOS 7 + SELinux + PHP + Apache – cannot write/access file no matter what | Lysender's Daily Log Book](https://blog.lysender.com/2015/07/centos-7-selinux-php-apache-cannot-writeaccess-file-no-matter-what/)

` sudo chcon -t httpd_sys_rw_content_t /var/www/html/var/tmp/ -R` **worked for me!** 🙂

---

<div class="post-metadata">

**Author:** ![wget](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.mautic.org/wget/32/6916_2.png) [@wget](https://forum.mautic.org/u/wget)\
**Post date:** [March 3, 2022, 5:51pm UTC](https://forum.mautic.org/t/cant-load-new-template-email/18884/4 "2022-03-03T17:51:03Z")

</div>

If you are using a Docker environment this also can be caused by a bad (i.e. not writable) location defined in `app/config/local.php` under the `tmp_path` key.

On my side, in a Docker env, the Docker volume was mounted to the `/var/www/html/` **inside** the container, which means all the Mautic content was at that location.

The problem is that my key was:

```auto
        'tmp_path' => '/var/www/tmp/',

```

which wasn’t a writable location inside the container, changing it to:

```auto
        'tmp_path' => '/var/www/html/var/tmp',

```

fixed the issue as it was pointing to a location inside the mapped Docker volume.

---

<div class="post-metadata">

**Author:** ![mybpoconsultant](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.mautic.org/mybpoconsultant/32/6161_2.png) [@mybpoconsultant](https://forum.mautic.org/u/mybpoconsultant)\
**Post date:** [October 9, 2024, 4:39am UTC](https://forum.mautic.org/t/cant-load-new-template-email/18884/5 "2024-10-09T04:39:23Z")

</div>

Your champion, and your solution worked for me to fix my Unsubscribe page not working in my Mautic Docker Container. I noticed a couple of things (and I used EasyPanel to build Mautic v4.4.9 on Ubuntu 22.04 LTS Docker Build) - So I went to the terminal and I entered the config file and found that it said

**‘tmp\_path’ =\> ‘/var/www/html/app/…/var/tmp’,**

so I changed this to how you reccommended it which, just to clarify for others was

**‘tmp\_path’ =\> ‘/var/www/html/var/tmp’,**

A quick question for you though @wget do I also need to be concerned about path to cache directory and path to log directory as picture below? I noticed that I changed **‘tmp\_path’ =\> ‘/var/www/html/app/…/var/tmp’,** to what you suggested to **‘tmp\_path’ =\> ‘/var/www/html/var/tmp’,** and that those have very similar file structure…

 ![image](https://us1.discourse-cdn.com/flex020/uploads/mautic/original/2X/2/2f9220d54b747815f049064303121b620b61d44e.png)

For those that want an easy tutorial on how to fix this please see below…

This is how it now looks in my terminal right near the top of the file

 ![image](https://us1.discourse-cdn.com/flex020/uploads/mautic/original/2X/4/45de2869f43f3295ef724142ad77d4c818e701d8.png)

PS - to get to this file you are going to have to be in root - it would not allow me even with a non root user that had sudo priviliges, just ask ai and it will help you get to your file but my structure looked like this (in EasyPanel anyways)

root@srv557064:/etc/easypanel/projects/clientsprojectname/mautic/volumes/mautic\_data/app/config# nano local.php

So after this, my unsubscribe page finally worked, I am guessing that is because of what you are talking about in regards to the tmp\_path key and those users having a temporary access key or something to see their custom landing page for unsubscribe… for anyone else that wants a nice unsubscribe email template, here is the code for it below that works with the {unsubscribe\_text} at the bottom of your emails, you need to put this in Configuration → Email Settings → Unsubscribed confirmation message Section

 ![image](https://us1.discourse-cdn.com/flex020/uploads/mautic/original/2X/3/351f3420e4b98a2e402d2f08837bb0b756740118.png)

here is the code for that if you want to put in Configuration\>Email Settings\>Unsubscribed confirmation message

```auto
<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Unsubscribed</title>
    <style>
        body {
            font-family: Arial, sans-serif;
            background-color: #f0f0f0;
            display: flex;
            justify-content: center;
            align-items: center;
            height: 100vh;
            margin: 0;
        }
        .container {
            background-color: white;
            padding: 40px;
            border-radius: 10px;
            box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
            text-align: center;
            max-width: 400px;
        }
        h1 {
            color: #4a4a4a;
            margin-bottom: 20px;
        }
        p {
            color: #666;
            line-height: 1.6;
        }
        .emoji {
            font-size: 48px;
            margin-bottom: 20px;
        }
        .button {
            display: inline-block;
            padding: 10px 20px;
            background-color: #3498db;
            color: white;
            text-decoration: none;
            border-radius: 5px;
            transition: background-color 0.3s ease;
        }
        .button:hover {
            background-color: #2980b9;
        }
    </style>
</head>
<body>
    <div class="container">
        <div class="emoji">👋</div>
        <p>We are sorry to see you go! |EMAIL| will no longer receive emails from us.</p>
        <p>If this was by mistake, <a href="|URL|" class="button">click here to re-subscribe</a>.</p>
        <p>If you ever change your mind, feel free to email us back!</p>
    </div>
</body>
</html>

```
