3

Does anyone know how to edit/set/override the email character limit in ExpressionEngine 3?

Is it possible to set it anywhere in the CP or do I have to change it in the v3 system code?

3
  • Can you be more specific about where you want to increase the character limit? A specific setting? Form input? Field type? Mar 10 '17 at 20:24
  • The email address field in the member registration form.
    – David
    Mar 10 '17 at 21:32
  • Thanks David, I've answered below, but am intensely curious on the site reqs that has you looking to increase this limit! Mar 10 '17 at 22:01
2

Email (and username / screen name) are limited to 75 characters in ExpressionEngnie. This study shows that roughly 95% of email addresses on the web are 31 characters or less, and most of the rest of the remaining 5% fall within 75 characters. On our own site with hundreds of thousands of active users, the median is closer to 20 characters.

The imposed limitation in MySQL aids in database performance and scalability, so I would question whether or not you really want to raise this limit. But if you must, you can execute this query on the database:

ALTER TABLE exp_members MODIFY email varchar(75) NOT NULL;

Replacing 75 with your desired limit. You would also need to hack system/ee/legacy/libraries/Core.php to modify the USERNAME_MAX_LENGTH constant to the same limit, or you will have form validation errors.

It should be noted that modifying default schema in this way is not recommended, as the application would always assume expected values, and could enable functional or structural changes in the future that would override a hack made to the database, even potentially truncating addresses that you've allowed over 75 characters. You'd also have to maintain that hack to the Core library after every update.

2
  • We were seeing a restriction at 32 characters. I followed up with the developer who had requested the update to figure out where that was. 75 is definitely more than enough.
    – David
    Mar 13 '17 at 13:04
  • Ah, okay! Must be a much older version, though the last I recalled it was 50 prior to the increase of username/screen name /email to 75. Mar 13 '17 at 14:22

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.