Is it possible to send e-mail based on recipient's preferred language?

Comments

vasike’s picture

i think you're right. thanks a lot

for User defined in the rule or arbitrary recipients it's easy & obvious.

What about roles?
Do you have any ideeas/directions?
i don't think it will be so nice to call mail_template builder and/or mimemail sender for every user of the choosen roles.

maximpodorov’s picture

BTW, I removed the unneeded line (as I think):

--- mail_template.rules.inc.orig        2011-05-02 13:56:24.000000000 +0200
+++ mail_template.rules.inc     2011-05-10 16:38:02.000000000 +0200
@@ -111,7 +111,7 @@
        } elseif ($settings['recipients_type'] == 'arbitrary') {
                $mail['to'] = empty($settings['recipients']['to']) ? array() : explode(',', $settings['recipients']['to']);
        } else {
-               global $user;
+               //global $user;
                $mail['to'] = array($user->mail);
                $mail['language'] = $user->language;
        }

As for whole role recipients, you can divide all users of that role into language groups and send mail to groups (not to every user separately).

vasike’s picture

thanks. i thought also about the same solution

BUT: What if i want to use this user tokens in the Mail Template? Or maybe it's not possible?
I think that we need to send distinct emails. ???
Anyway i think this a general issue.
What do you think?

maximpodorov’s picture

User tokens (for the user to whom the message is sent) must be available in templates, I think.
BTW, I created a module which adds token for user password (it's available when password is changed or set initially). I'd like to replace standard Drupal email notification of new user creation with templates created with your module, but this requires working user tokens in templates.

vasike’s picture

Status: Active » Fixed

thanks for the support
answers
1. language support it seems to be solved. check the last commit.

2. about using user token, i think it should work too, it's just about using the right settings in the Rule.
if you face problems please open a new task about.

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.