I'm trying to import about 15000 users from a CSV file. Most of the users have valid email addresses, but some (+/- 5000) don't, they're also not blank fields.

Is there a way that I can bypass the email validation? Or a module that can easily help with this?

I've tried re-importing the CSV file with "Do not replace existing users" and removing the email field from the mapping, and I still cannot import them and am getting the "User name missing or email not valid."

I have Optional Mail installed, and have tried importing after disabling the email field for registrations and edit pages and still get the same error.

Any ideas?


The validation logic for the email is embedded within the user feeds module in FeedsUserProcessor.inc which means the best way to go about this is to create you own, almost identical, feeds processor in your own custom module. Read up on how to create a custom processor.

After reading that documentation you'll need a processor class and you can use FeedsUserProcessor.inc within the feeds module as a starting point. Copy that file into your own module where necessary, rename it and also rename the class name defined within the file. In this file you should see this implementation of the entityValidate function:

 * Validates a user account.
protected function entityValidate($account) {
  if (empty($account->name) || empty($account->mail) || !valid_email_address($account->mail)) {
  throw new FeedsValidationException(t('User name missing or email not valid.'));

Remove the !valid_email_address($account->mail) bit in that if statement and configure your feeds importer to use the custom processor you just created.

FYI, I would not recommend importing users with invalid email addresses as this will cause major problems with your users trying to use your site properly.

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.