we have got a multisite environment and have imported users with different preferred languages (de and en). Therefore we made a module, cause the feedme plugin doens't set the preferred language https://github.com/craftcms/feed-me/issues/612. All the users are set to pending. Now we want to sent the activation mails for alle these imported users, so they can set their passwords.

The email is translated cause of the preferred language - thumbs up - but the with the activation code is just from one domain - in our case the .de domain. This means, all users with a preferred language set to "en" are getting a well translated mail, with a link to the .de page and not the .com for setting their passwords.

So the question is: why is the link not dependent on the preferred language as well or could be localized via a config for this case?

1 Answer 1


This issue was discussed a while ago here: https://github.com/craftcms/cms/issues/3029

As Brandon says, Craft basically has no knowledge of which site a user belongs to as they're all global.

Bear in mind that emails that are triggered from the front end will use the domain name where they were triggered from - this problem only really affects emails triggered from the control panel.

The workaround discussed at the bottom there is probably your best bet: use Twig's replace filter to dynamically replace the domain name in the link variable according to what you know about the user (in your case, their preferred language).

{% set link = user.preferredLanguage == 'en' ? link|replace('https://www.site.de','https://www.site.com') : link %}

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.