How do I restrain domain names of e-mails in the Drupal registration form? On the registration page, I want to restrict the domain of the e-mail adress only between a few choices (to limit the use of the site to internal company use only) through a list of choices. The user, upon registration, would therefore only have to write the characters before the @ sign ; and then choose the correct domain name he uses (for instance yahoo.fr).
The final value of the email registered by Drupal (and thus registered in the database) should be like this one: [User_entry]+[@]+[chosen_domain_name].
I found some functions to verify the e-mail spelling, but I really want users only to have the choice between shown domain names.

I've read some answers talking about hook_form_user_login_alter(), but I still don't get how I could make it...

Thks for your replies !
I'm not sure if you have any experience in PHP or custom module development but I don't have time to give you a working example.  However I will point you in the right direction.  

• Create a custom module

• Use hook_form_alter to alter the form with the form id user_registration

• In your hook_form_alter add a custom validation function and ensure it is the first validation function that runs

• In your hook_form_alter unset the mail element and add two elements for the two parts of your form (the text input and the dropdown list of domains)

• In your custom validation function, use the submitted values of your form elements to create an email address and assign it to the element you unset before, mail

• Make sure that in the validation function, you don't allow users to submit blank values

Edit for a fuller answer to be added

Ok, apologies for taking my time.  This code is untested but should hopefully work for what you want to do.  First of all, try to avoid doing things like this in the theme layer.  The theme layer should be for themes only, so you want to create a custom module.

To create your module you need to create a .info file.  Alter the following code and paste it into your text editor and save it as example.info.  Remember that you can change the names of the files etc to whatever suits you, just replace the word "example" with whatever name you want to give it.  Please note that Drupal deliberately omits the closing ?&gt; PHP tag.

name = "Example module"
description = "Gives an example of a module."
core = 6.x
package = Other


Next, you want to save a file called example.module.  Inside this file, you will want to copy the following code.  This code follows the instructions that I gave you in my previous answer.  I have tried to comment this code as well as possible in order to try to show you what is being done and why.  This should do what you want it to do.

&lt;?php

/**
 * Implementation of hook_form_alter()
 */
function example_form_alter(&amp;$form, &amp;$form_state, $form_id) {
    // If the form is the user_register form
    if ($form_id == 'user_register') {
        // Attach our custom validation function as the first validation function
        array_unshift($form['#validate'], '_example_user_validate');
        // Hide the email address field
        $form['mail']['#type'] = 'hidden';
        // Give the email address field a random default value (in this case a random number and a timestamp)
        // as we cannot unset it due to Drupal's validation rules
        $form['mail']['#default_value'] = rand(1111, 9999) . '@' .time() . '.com';
        // Add our new text entry field
        $form['mail_first'] = array(
      '#type' =&gt; 'textfield',
      '#title' =&gt; t('Email address'),
      '#default_value' =&gt; '',
      '#size' =&gt; 60,
      '#maxlength' =&gt; 64,
      '#required' =&gt; TRUE,
    );
        // Add our select list of possible email domain values
        $form['mail_last'] = array(
      '#type' =&gt; 'select',
      '#prefix' =&gt; '@',
      '#options' =&gt; array(
              // These are the possible email address domains
              'yahoo.fr' =&gt; 'yahoo.fr',
              'yahoo.com' =&gt; 'yahoo.com',
              'example.com' =&gt; 'example.com',
            ),
      '#required' =&gt; TRUE,
    );
    }
}

/**
 * Function to piece together our email address
 */
function _example_user_validate(&amp;$form, &amp;$form_state) {
    // If our two form elements have values
    if (!empty($form_state['values']['mail_first']) &amp;&amp; !empty($form_state['values']['mail_last'])) {
        // Set the email address to the correct value
        $form_state['values']['mail'] = $form_state['values']['mail_first'] . '@' . $form_state['values']['mail_last'];
    }
}