# {unsubscribe\_url} results in error 500

**URL:** <https://forum.mautic.org/t/unsubscribe-url-results-in-error-500/34304>\
**Category:** Product Support\
**Created:** [December 4, 2024, 8:46am UTC](https://forum.mautic.org/t/unsubscribe-url-results-in-error-500/34304 "2024-12-04T08:46:52Z")\
**Posts on this page:** 8\
**Page:** 1

<div class="post-metadata">

**Author:** ![taxi](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.mautic.org/taxi/32/522_2.png) [@taxi](https://forum.mautic.org/u/taxi)\
**Post date:** [December 4, 2024, 8:46am UTC](https://forum.mautic.org/t/unsubscribe-url-results-in-error-500/34304/1 "2024-12-04T08:46:52Z")

</div>

**Your software**  
My Mautic version is: 5.1.1  
My PHP version is: 8.1.26  
My Database type and version is: 10.11.9-MariaDB-0+deb12u1

**Your problem**  
My problem is:

The Unsubscribe Link does not work. I can’t say since when, but it must be since an update. I don’t check this every time, I’m composing an email.

These errors are showing in the log:

mautic.CRITICAL: Uncaught PHP Exception Twig\Error\LoaderError: “Unable to find template “:divine-partnership:base.html.twig” (looked into: /var/www/clients/client1/web49/web/mautic/vendor/knplabs/knp-menu/src/Knp/Menu/Resources/views, /var/www/clients/client1/web49/web/mautic/vendor/symfony/twig-bridge/Resources/views/Form) in “@themes/divine-partnership/html/message.html.twig” at line 1.” at /var/www/clients/client1/web49/web/mautic/vendor/twig/twig/src/Loader/FilesystemLoader.php line 234 {“exception”:“[object] (Twig\Error\LoaderError(code: 0): Unable to find template ":divine-partnership:base.html.twig" (looked into: /var/www/clients/client1/web49/web/mautic/vendor/knplabs/knp-menu/src/Knp/Menu/Resources/views, /var/www/clients/client1/web49/web/mautic/vendor/symfony/twig-bridge/Resources/views/Form) in "@themes/divine-partnership/html/message.html.twig" at line 1. at /var/www/clients/client1/web49/web/mautic/vendor/twig/twig/src/Loader/FilesystemLoader.php:234)”} {“hostname”:“mars”,“pid”:112569}

The problem with this is, that the lookup path is wrong. Templates are not located under knblabs/knp-menu/src/Knp

How comes that Mautic looks there for the template.

Steps I have tried to fix the problem:  
Deactivate Twig Plugin.

No success.

There is a message with this topic, but no solution.

Many thanks

Christian

---

<div class="post-metadata">

**Author:** ![taxi](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.mautic.org/taxi/32/522_2.png) [@taxi](https://forum.mautic.org/u/taxi)\
**Post date:** [December 4, 2024, 10:39am UTC](https://forum.mautic.org/t/unsubscribe-url-results-in-error-500/34304/3 "2024-12-04T10:39:15Z")

</div>

The strange thing is, that if the unsubscribe link i.e. {unsubscribe\_url} is clicked from a “Truly Personal” email template, the link works properly.

If the same link is placed in a custom email template again via {unsubscribe\_url} and clicked then, the error occurs.

I copied the two links and compared them. They are identical.

I deleted the cache, did an update via composer, checked the rights.

---

<div class="post-metadata">

**Author:** ![silavapi](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.mautic.org/silavapi/32/7424_2.png) [@silavapi](https://forum.mautic.org/u/silavapi)\
**Post date:** [December 4, 2024, 10:42am UTC](https://forum.mautic.org/t/unsubscribe-url-results-in-error-500/34304/4 "2024-12-04T10:42:49Z")

</div>

Does your custom template have all the necessary twig files (base.html.twig and message.html.twig for example)?

---

<div class="post-metadata">

**Author:** ![taxi](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.mautic.org/taxi/32/522_2.png) [@taxi](https://forum.mautic.org/u/taxi)\
**Post date:** [December 4, 2024, 10:45am UTC](https://forum.mautic.org/t/unsubscribe-url-results-in-error-500/34304/5 "2024-12-04T10:45:29Z")

</div>

Yes, all of them:

base.html.twig  
email.html.twig  
email.mjml.twig  
message.html.twig

---

<div class="post-metadata">

**Author:** ![taxi](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.mautic.org/taxi/32/522_2.png) [@taxi](https://forum.mautic.org/u/taxi)\
**Post date:** [December 4, 2024, 11:17am UTC](https://forum.mautic.org/t/unsubscribe-url-results-in-error-500/34304/6 "2024-12-04T11:17:23Z")

</div>

I have to revise my former post. The links are not identical. They differ in the number after the unsubscribe:

[https://website.com/email/unsubscribe/67500de418ce4807651794/mail@gmail.com/69a087ed11dde3f256b34dd893807630cbc9fe650f477169e05e6c3b5257df54](https://website.com/email/unsubscribe/67500de418ce4807651794/mail@gmail.com/69a087ed11dde3f256b34dd893807630cbc9fe650f477169e05e6c3b5257df54)  
[https://website.com/email/unsubscribe/67500ddaa0488012951510/mail@gmail.com/69a087ed11dde3f256b34dd893807630cbc9fe650f477169e05e6c3b5257df54](https://website.com/email/unsubscribe/67500ddaa0488012951510/mail@gmail.com/69a087ed11dde3f256b34dd893807630cbc9fe650f477169e05e6c3b5257df54)

I guess that number is a kind of template ID where the link is placed.

---

<div class="post-metadata">

**Author:** ![ricfreire](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.mautic.org/ricfreire/32/14973_2.png) [@ricfreire](https://forum.mautic.org/u/ricfreire)\
**Post date:** [December 4, 2024, 4:28pm UTC](https://forum.mautic.org/t/unsubscribe-url-results-in-error-500/34304/8 "2024-12-04T16:28:30Z")

</div>

Hello @taxi,

The unsubscribe functionality is working correctly, and the issue you’re facing is not related to the update. I am 99.9% certain that the problem lies with your custom email theme.

**Here’s what you can do:**

1. Visit [my website](https://crafting.email/) and download any template you like. ([This article](https://crafting.email/how-to-easily-add-crafting-email-themes-to-mautic/) might be helpful.)
2. Edit **only** the `email.mjml.twig` file. Delete the entire email template and paste your own. Don’t forget to validate your email code [here](https://crafting.email/mjml-validator/).
3. After validation, copy the validated email code and paste it into the `email.html.twig` file.
4. (Optional) If you’d like, you can modify the thumbnail, `composer.json`, and `config.json`. These can also be updated later, once you’re sure your email is working fine.
5. Save the template and upload it to your Mautic instance.

Once you’ve done this, check if the error appears again. If you need further assistance, feel free to reach out to me on Mautic’s Slack 😄

Best regards,  
Ricardo

---

<div class="post-metadata">

**Author:** ![taxi](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.mautic.org/taxi/32/522_2.png) [@taxi](https://forum.mautic.org/u/taxi)\
**Post date:** [December 7, 2024, 9:34am UTC](https://forum.mautic.org/t/unsubscribe-url-results-in-error-500/34304/9 "2024-12-07T09:34:36Z")

</div>

Many thanks Ricardo,

so kind.  
I fixed it in the way, that I took another default email template and modified it via the template editor and the unsubscribe link works now.  
It was for me the faster way, than checking what the problem with my custom footer was.

Beste regards

Christian

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/flex020/uploads/mautic/original/1X/43c63600fe51440378769136903f1fa2a9a34102.png) [@system](https://forum.mautic.org/u/system)\
**Post date:** [December 8, 2024, 9:35pm UTC](https://forum.mautic.org/t/unsubscribe-url-results-in-error-500/34304/10 "2024-12-08T21:35:13Z")

</div>

This topic was automatically closed 36 hours after the last reply. New replies are no longer allowed.
