By default, the email field in the users table is a varchar(64). However, the proxy emails given by facebook (and used by FBconnect for the fast-signup) can be longer than 64. E.g, here is my email as returned from facebook: (some numbers changed)

apps+71659511993.252800001.671353761e563e7852e650c93c3b821c@proxymail.facebook.com

I was able to fix this by manually changing the length of the field in MySQL. Not sure what the right thing to do is, other than having drupal core use a more realistic email size. (64 is reallysmall!)

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

hankpalan.com’s picture

This seems to really be a problem with Drupal Core. It is beyond me to even think of what could be done.

I would like to pose the question of, does that e-mail address go anywhere? I tried to e-mail myself using the proxy email address I was given, but not sure where it went. But then again I'm a little over my head when it comes to a lot of the technical stuff with e-mail.

LaNets’s picture

Hi,

Here you can find more information about the Facebook proxy email.
Proxied Email

Ryan Palmer’s picture

Title: Facebook proxy email is too long for Drupal user email » Increase maximum allowable length of email addresses
Project: Facebook Connect » Drupal core
Version: 6.x-1.0-beta8 » 7.x-dev
Component: Code » user.module
Status: Active » Needs review
FileSize
1.56 KB

This is a bug in Drupal core, IMO. I propose the allowed email address length be doubled to 128 characters.

For those who need a dirty fix now, try altering the field using phpMyAdmin or run the following from mysql prompt:

ALTER TABLE `users` CHANGE `mail` `mail` VARCHAR( 128 ) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL

Patch against Drupal 7 head attached. I don't have an upgradable version of Drupal 7 handy.. would anybody like to test the upgrade path? :)

----
This patch is contributed by TP1 Internet 360, a Montreal-based Drupal web studio.

kamkejj’s picture

If I understand the info from Wikipedia http://en.wikipedia.org/wiki/Domain_Name_System then the domain name alone can be 253 characters long. Why not make the length the max size of VARCHAR.

samhassell’s picture

For the record, RFC2821 (SMTP) section 4.5.3.1 states:

local-part
The maximum total length of a user name or other local-part is 64
characters.
domain
The maximum total length of a domain name or number is 255
characters.

see: ftp://ftp.rfc-editor.org/in-notes/rfc2821.txt

Also the limits on mysql varchar (though some thought should be given to other database formats?):

Values in VARCHAR columns are variable-length strings. The length can be specified as a value from 0 to 255 before MySQL 5.0.3, and 0 to 65,535 in 5.0.3 and later versions. The effective maximum length of a VARCHAR in MySQL 5.0.3 and later is subject to the maximum row size (65,535 bytes, which is shared among all columns) and the character set used.

see: http://dev.mysql.com/doc/refman/5.0/en/char.html

Ryan Palmer’s picture

@kamkejj Your point is good, and highlights the absurdity of the 64 character maximum now.

So, given MySQL 5+ (a requirement for Drupal 7) supports varchar's longer than 256 characters, should we go ahead and make this field 320 characters (64 + 1 + 255) long?

Re-rolled.

Ryan Palmer’s picture

Bump bump. Test bot, où êtes-vous?

Ryan Palmer requested that failed test be re-tested.

Dries’s picture

+++ modules/user/user.module    15 Dec 2009 21:35:01 -0000
@@ -14,7 +14,7 @@ define('USERNAME_MAX_LENGTH', 60);
 /**
  * Maximum length of user e-mail text field.
  */
-define('EMAIL_MAX_LENGTH', 64);
+define('EMAIL_MAX_LENGTH', 320);

It would be good if we could extend this comment to reference the RFC, and where the 320 length comes from?

lilou’s picture

Herman Hiddema’s picture

As noted at #470306: User email column too short (only 64 chars, should be 255):

Actually, spec is that the email address can be at most 254 characters long, not 320.

RFC5321 (SMTP) section 4.5.3.1.3 restricts the path element to 256 chars, including opening and closing angled brackets.

See also:
http://www.eph.co.uk/resources/email-address-length-faq/

Ryan Palmer’s picture

Status: Fixed » Needs review
FileSize
1.6 KB

Re-rolled as per #9 and #11.

----
This patch is contributed by TP1 Internet 360, a Montreal-based Drupal web studio.

grendzy’s picture

subscribe.

Dries’s picture

Status: Needs review » Fixed

Committed to CVS HEAD. Thanks.

Status: Needs review » Closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.

MikeBC’s picture

Sorry to re-open a closed issue, but now that this patch has been "committed to CVS HEAD" does that mean there is an updated version of core somewhere, or of the user core module, that I can download and install? or should I open up my user.module and user.install files and make the edits manually?

In either case, are there additional steps such as running 'update.php' after installing/patching?

or, as a newly-minted drupal admin of a live site, should I just bite the bullet and install CVS and SVN on my server per this guide (http://nicksergeant.com/blog/drupal/painless-drupal-revision-control-cvs...)? Thanks in advance for your help and insight.

grendzy’s picture

MikeBC: Currently, this fix is only for Drupal 7. I you want to propose a backport to Drupal 6, you can reopen the issue by setting the status to "active" and the version to 6.x.

MikeBC’s picture

Thanks--that explains why the version numbers and line numbers in the patch file didn't match my installed versions (D6.15).

These updates are trivial to do manually. I just edited the 2 files, changed the actual field size in the db table in phpmyadmin.

For folks who have already captured parts of proxy email addresses, the full form ends with

@proxymail.facebook.com

so where i saw ######@pro in my users table
i just tacked "xymail.facebook.com" on the end in phpmyadmin.

crehnelt’s picture

Version: 7.x-dev » 6.x-dev

Hi!
I've already made the patches and the proxied email is stored correctly in the db.
Does anybody know if you can send emails to this address.
It would be nice to get the real email address, is this possible?
Regards
Chris

andypost’s picture

andypost’s picture

Status: Closed (fixed) » Patch (to be ported)
Issue tags: +Needs backport to D6

Let's re-open this issue! Maybe Gabor agree with schema changes in D6 for this case...

marvil07’s picture

Status: Needs review » Needs work

The last submitted patch, 0001-Issue-502968-by-Ryan-Palmer-marcingy-andypost-marvil.patch, failed testing.

pdumais42’s picture

FileSize
2.01 KB

I created a new patch based on the latest submitted version (which failed testing). I applied it to Drupal 6.22 without any errors. Attached for you consideration.

Notes:
I changed the syntax of the db_change_field - was missing args.
I removed the options to create an index on the mail field - since it already exists - which causes an error.

Usage:
patch -p0 < user_email_length.patch

pdumais42’s picture

FileSize
1.96 KB

Crap. Rolled a new version. Last version was the one with the duplicate index error.

marvil07’s picture

@pdumais42: Thanks for the new patch. You are right about an index problem. But the right solution is to drop the index and then re-create it again, so instead of removing the index definition from the definition we need to drop it before changing the field.

Details on api documentation for db_change_field().

So, still on "needs work" status.

pdumais42’s picture

When I apply my patch to a clean copy of Drupal core I get no errors. I think the patch is correct. No?

The issue with the conflicting index was introduced in a previous patch (#22) which I had used as my starting point for this patch. Basically, the patch in #22 was almost correct. I just fixed it by removing the attempt to add an index that already exists.

FYI - I just downloaded a fresh tarball of drupal 6.22 and 6.x-dev and applied the patch to both cleanly. So, I think it's okay.

patch -p0 < user_email_length.patch
patching file modules/user/user.module
patching file modules/user/user.install

Let me know if I have made a mistake.

-ped-

marvil07’s picture

Status: Needs work » Needs review
FileSize
1.72 KB
naxoc’s picture

Status: Needs review » Reviewed & tested by the community
Issue tags: -Needs backport to D6

I tested the patch and it works great. Would be great for D6 to also have more room in the mail field in the users table.

Status: Reviewed & tested by the community » Closed (outdated)

Automatically closed because Drupal 6 is no longer supported. If the issue verifiably applies to later versions, please reopen with details and update the version.