I have a custom registration form with three options(premium, trial and group). The premium user does not need email verification but other two do. So I need to send verification email pro-grammatically.

I have searched google where I got only options for some modules. But my need is only sending an email with unique URL for verifcation.

Please suggest me the drupal function that helps me achieve this.

Thank you


You could use hook_mail_alter to abort the verification email being sent in the condition that the user is using the premium option. As stated on the api.drupal.org page if you set the 'send' parameter of the $message data to FALSE it will abort sending the email.

You'll need to retrieve the 'premium' context within your implementation of hook_mail_alter() to achieve this, which may require setting that property on the user, the session, or in a custom database table.

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.