In account settings ,Account Activation mail settings is general i think so.

I want the account activation mail to be altered. I want to check roles, according to that display the mail messages .

how will i do that?


You can create a new rule like this

EVENT saying After saving a new user account

Conditions saying  User has role(s)  check your role there.

Actions saying send mail you can send the mail what you want in that.

  • Then two mail will be send I think – RajeevK Aug 7 '13 at 7:52
  • @RajeevK: how two mail will go. In the account settings he can disable that account activation mail.So only this will go.is that right ? – Ram Aug 7 '13 at 7:54
  • Then default mail will be disabled for each user type registration. Suppose there are 5 user type & I want to send custom mail to only 3 type of user registration but simple authenticate user registration will have default alert mail then your solution doesn't work.. – RajeevK Aug 7 '13 at 7:57
  • @RajeevK: Yes understood, but he can create new rules and check for roles according to that mail will send for each rules. That is what is question meant i think. Roles and messages. – Ram Aug 7 '13 at 8:02
  • You mean several rules for each role. Then it can be done.. – RajeevK Aug 7 '13 at 9:47

You should look into the hook_mail_alter for overriding the mail, which get send after user_save. You can look into the answer given for this question here --

Override _user_mail_notify() to NOT send email on user_save() if user status is changed

Though question is not relevant but the answer is.

  • I want to alter only for account activation.Not for all. – NewToDrupal Aug 7 '13 at 8:04
  • @NewToDrupal - This won't alter all the mail but you can write your logic inside and alter only that mail which you want to target. Like for account activation of usertype one.. It totally depends upon you to write the logic.. – RajeevK Aug 7 '13 at 9:46

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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