S
Supabase•2mo ago
claas.sh

[SOLVED] Help with template Emails on Self-Host

Hello, My E-Mail Template won't load correctly. My Auth Compose:
...
volumes:
- ../files/volumes/invite.html:/home/supabase/invite.html
- ../files/volumes/confirm.html:/home/supabase/confirm.html
- ../files/volumes/recovery.html:/home/supabase/recovery.html
- ../files/volumes/magiclink.html:/home/supabase/magiclink.html
- ../files/volumes/email_change.html:/home/supabase/email_change.html
environment:
GOTRUE_MAILER_TEMPLATES_INVITE: ${MAILER_TEMPLATES_INVITE}
GOTRUE_MAILER_TEMPLATES_CONFIRMATION: ${MAILER_TEMPLATES_CONFIRMATION}
GOTRUE_MAILER_TEMPLATES_RECOVERY: ${MAILER_TEMPLATES_RECOVERY}
GOTRUE_MAILER_TEMPLATES_MAGIC_LINK: ${MAILER_TEMPLATES_MAGIC_LINK}
GOTRUE_MAILER_TEMPLATES_EMAIL_CHANGE: ${MAILER_TEMPLATES_EMAIL_CHANGE}

GOTRUE_MAILER_SUBJECTS_CONFIRMATION: ${MAILER_SUBJECTS_CONFIRMATION}
GOTRUE_MAILER_SUBJECTS_RECOVERY: ${MAILER_SUBJECTS_RECOVERY}
GOTRUE_MAILER_SUBJECTS_MAGIC_LINK: ${MAILER_SUBJECTS_MAGIC_LINK}
GOTRUE_MAILER_SUBJECTS_EMAIL_CHANGE: ${MAILER_SUBJECTS_EMAIL_CHANGE}
GOTRUE_MAILER_SUBJECTS_INVITE: ${MAILER_SUBJECTS_INVITE}
...
volumes:
- ../files/volumes/invite.html:/home/supabase/invite.html
- ../files/volumes/confirm.html:/home/supabase/confirm.html
- ../files/volumes/recovery.html:/home/supabase/recovery.html
- ../files/volumes/magiclink.html:/home/supabase/magiclink.html
- ../files/volumes/email_change.html:/home/supabase/email_change.html
environment:
GOTRUE_MAILER_TEMPLATES_INVITE: ${MAILER_TEMPLATES_INVITE}
GOTRUE_MAILER_TEMPLATES_CONFIRMATION: ${MAILER_TEMPLATES_CONFIRMATION}
GOTRUE_MAILER_TEMPLATES_RECOVERY: ${MAILER_TEMPLATES_RECOVERY}
GOTRUE_MAILER_TEMPLATES_MAGIC_LINK: ${MAILER_TEMPLATES_MAGIC_LINK}
GOTRUE_MAILER_TEMPLATES_EMAIL_CHANGE: ${MAILER_TEMPLATES_EMAIL_CHANGE}

GOTRUE_MAILER_SUBJECTS_CONFIRMATION: ${MAILER_SUBJECTS_CONFIRMATION}
GOTRUE_MAILER_SUBJECTS_RECOVERY: ${MAILER_SUBJECTS_RECOVERY}
GOTRUE_MAILER_SUBJECTS_MAGIC_LINK: ${MAILER_SUBJECTS_MAGIC_LINK}
GOTRUE_MAILER_SUBJECTS_EMAIL_CHANGE: ${MAILER_SUBJECTS_EMAIL_CHANGE}
GOTRUE_MAILER_SUBJECTS_INVITE: ${MAILER_SUBJECTS_INVITE}
The .env file:
...
# Email Templates
MAILER_TEMPLATES_INVITE="/home/supabase/invite.html"
MAILER_TEMPLATES_CONFIRMATION="/home/supabase/confirm.html"
MAILER_TEMPLATES_RECOVERY="/home/supabase/recovery.html"
MAILER_TEMPLATES_MAGIC_LINK="/home/supabase/magiclink.html"
MAILER_TEMPLATES_EMAIL_CHANGE="/home/supabase/email_change.html"
MAILER_SUBJECTS_INVITE="You have been invited!"
MAILER_SUBJECTS_CONFIRMATION="Confirm your E-Mail"
MAILER_SUBJECTS_RECOVERY="Recover your account"
MAILER_SUBJECTS_MAGIC_LINK="Your magic link"
MAILER_SUBJECTS_EMAIL_CHANGE="Change your E-Mail"
...
...
# Email Templates
MAILER_TEMPLATES_INVITE="/home/supabase/invite.html"
MAILER_TEMPLATES_CONFIRMATION="/home/supabase/confirm.html"
MAILER_TEMPLATES_RECOVERY="/home/supabase/recovery.html"
MAILER_TEMPLATES_MAGIC_LINK="/home/supabase/magiclink.html"
MAILER_TEMPLATES_EMAIL_CHANGE="/home/supabase/email_change.html"
MAILER_SUBJECTS_INVITE="You have been invited!"
MAILER_SUBJECTS_CONFIRMATION="Confirm your E-Mail"
MAILER_SUBJECTS_RECOVERY="Recover your account"
MAILER_SUBJECTS_MAGIC_LINK="Your magic link"
MAILER_SUBJECTS_EMAIL_CHANGE="Change your E-Mail"
...
The files are found with their contents inside /home/supabase/ in the Container! Error:
2025/09/02 10:08:51 Error loading template from ./supabase/magiclink.html: mailer: unable to fetch mail template
2025/09/02 10:08:51 Error loading template from ./supabase/magiclink.html: mailer: unable to fetch mail template
4 Replies
inder
inder•2mo ago
These have to be urls which return email template text not files. I have written an article for setting up email templates with self hosted supabase. There is also a yt video linked in the article if you prefer that https://medium.com/@singh-inder/ultimate-guide-to-send-emails-with-self-hosted-supabase-including-custom-templates-21f778d2e4c3 Auth container makes http request to the urls and uses the returned value as template
claas.sh
claas.shOP•2mo ago
oh I see. Thank you 😄 when setting up the templates server. it will only be accessible for supabase in the configuration shown in your article right?
inder
inder•2mo ago
Yes, not public
claas.sh
claas.shOP•2mo ago
That worked Perfectly fine thank you!

Did you find this page helpful?