I am programmatically creating users for the roles Parent (Adult) & Child (minor). During registration, minors (Children) typically will not have email addresses but Drupal user registration requires email address.

During registration of minor, unfortunately, the adults email address cannot be reused based on Drupal’s one email rule.

My queries are as follows:

  1. Is it possible that we can create users without email address?
  2. If not 1. can we use some pseudo-email address that we can created for each minor. However, emails for any minor should be sent to the adults address instead.
  • Email is not required. The uid is the global identifier. But of course you have to make sure the email is unique since it is used in password reset or user_load_by_mail. for example when drupal is being installed the admin has no email until the admin submits the site configuration form during the installation process.
    – user21641
    Nov 15, 2017 at 14:32
  • @sukhjinder-singh I'd be interested to know what your use-case was and how you solved this problem. I'm guessing it was for a school? Jul 30, 2018 at 10:52

1 Answer 1


I think you need an email address, but I could be wrong about this.

You can definitely provide a fake email address though.

For example, you can use hook_form_alter() to modify the registration form:

function MYMODULE_form_user_register_form_alter(&$form, FormStateInterface &$form_state, $form_id) {
  // Hide the mail form
  $form['account']['mail']['#access'] = FALSE;
  // Set the email address to [email protected]
  // You need to write this code yourself...

Make sure you set the email address to include the UID or something similar that will ensure the email is unique; Drupal has to have a unique email for each account.

Then, use hook_mail_alter to check the user's role and, if the user is a minor, query the parent's email address and send the parent an email instead.

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.