Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Email customization problems #591

Open
EkoPages opened this issue Feb 9, 2024 · 1 comment
Open

Email customization problems #591

EkoPages opened this issue Feb 9, 2024 · 1 comment

Comments

@EkoPages
Copy link

EkoPages commented Feb 9, 2024

I use rest-auth combined with allauth for registration
I customized the reigstration endpoints and also the email being returned to users

whenever I test it out in localhost it returns the email the way I want it to be returned

`Dear TestUser1,

Welcome to Ekopages, your gateway to sustainable education!

We're thrilled to have you join our community. To get started on your journey towards a greener future, please click the link below to confirm your email address:

https://ekopages.com/registration/account-confirm-email/NTE:1rUpCQ:qimz8K0QFUD5ZM8WbMlmcBqq3HSzNp0vNSziMaJRV44/

Once confirmed, you'll have full access to ekopages.com, where learning meets sustainability.

Thank you for choosing Ekopages. Let's embark on this educational adventure together!

Green regards,
The EkoPages Team.
ekopages.com`

but whenever I push to production it returns

`Hello from !

Dear TestUser01,
Welcome to Ekopages, your gateway to sustainable education!

We're thrilled to have you join our community. To get started on your
journey towards a greener future, please click the link below to
confirm your email address:

https://ekopages.com/registration/account-confirm-email/ODI:1rYDAZ:9-iTNT6_wtKMwvWsrLLc1ATuzNwWIxAvTjUxLDP5G4Q/

Once confirmed, you'll have full access to ekopages.com, where
learning meets sustainability.

Thank you for using !`

Ive modified the emails and even the custom adapter still no luck. What can I do to fix this issue?

@Nealium
Copy link

Nealium commented Feb 16, 2024

This isn't an issue with dj-rest-auth, this email is an allauth feature.

Adding USE_I18N = False (disable translations) to your settings.py might fix your issue.

If it doesn't fix it or you want to keep translations:
You're issue resides with the base_message.txt "extends" inside email_confirmation_message.txt. Instead of removing the extends, the easiest fix for you is to override base_message.txt (this way it'll remove this text from all emails)

New File: {yourApp}/{yourTemplatesDir}/account/email/base_message.txt
File Contents:

{% block content %}{% endblock content %}

Original File

Explanation: I removed the translation blocks and the translation (i18n) load from the original

The reason you are getting two results (debug v production) most likely has something to do with translation not working while you're in debug. Theory being: there's no locale set/found in debug and therefor the blocks don't render. I'm not sure why this is. Docs

Unfortunately, I don't know where you're "Green regards," block went and I can't tell with the info provided. I suggest adding it to the new base_message.txt maybe that will fix it, plus it'll show up at the end of every email

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants