# Should importers import users with invalid email addresses by default?

**URL:** <https://meta.discourse.org/t/should-importers-import-users-with-invalid-email-addresses-by-default/71424>\
**Category:** Development\
**Created:** [2017 年10 月 4 日 20:31 UTC](https://meta.discourse.org/t/should-importers-import-users-with-invalid-email-addresses-by-default/71424 "2017-10-04T20:31:51Z")\
**Posts on this page:** 1\
**Showing post:** 1

<div class="post-metadata">

作者： ![pfaffman](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/pfaffman/32/120154_2.png) [@pfaffman](https://meta.discourse.org/u/pfaffman)\
发布日期： [2017 年10 月 4 日 20:31 UTC](https://meta.discourse.org/t/should-importers-import-users-with-invalid-email-addresses-by-default/71424/1 "2017-10-04T20:31:51Z")

</div>

Re-running an import with a bunch of invalid emails is a drag since it has to re-try adding each block of 1000 users if one of them is bad.

I don’t see a down side to importing users with bogus email addresses with a random one rather than throwing an error and think that all importers would benefit from creating those users rather than have their messages owned by @system. Is there something I’m missing?

Should I add something like this to `base.rb`?

```plaintext
          unless opts[:email].match(EmailValidator.email_regex)
            opts[:email]= "invalid#{SecureRandom.hex}@no-email.invalid"
          end

```

Arguably it should still print a warning. . .

---

_[View the full topic](https://meta.discourse.org/t/should-importers-import-users-with-invalid-email-addresses-by-default/71424)._
