Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
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!)
Comments
Comment #1
hankpalan.com CreditAttribution: hankpalan.com commentedThis 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.
Comment #2
LaNets CreditAttribution: LaNets commentedHi,
Here you can find more information about the Facebook proxy email.
Proxied Email
Comment #3
Ryan Palmer CreditAttribution: Ryan Palmer commentedThis 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.
Comment #4
kamkejj CreditAttribution: kamkejj commentedIf 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.
Comment #5
samhassell CreditAttribution: samhassell commentedFor the record, RFC2821 (SMTP) section 4.5.3.1 states:
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?):
see: http://dev.mysql.com/doc/refman/5.0/en/char.html
Comment #6
Ryan Palmer CreditAttribution: Ryan Palmer commented@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.
Comment #7
Ryan Palmer CreditAttribution: Ryan Palmer commentedBump bump. Test bot, où êtes-vous?
Comment #9
Dries CreditAttribution: Dries commentedIt would be good if we could extend this comment to reference the RFC, and where the 320 length comes from?
Comment #10
lilou CreditAttribution: lilou commentedMark #470306: User email column too short (only 64 chars, should be 255) as duplicated.
Comment #11
Herman Hiddema CreditAttribution: Herman Hiddema commentedAs 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/
Comment #12
Ryan Palmer CreditAttribution: Ryan Palmer commentedRe-rolled as per #9 and #11.
----
This patch is contributed by TP1 Internet 360, a Montreal-based Drupal web studio.
Comment #13
grendzy CreditAttribution: grendzy commentedsubscribe.
Comment #14
Dries CreditAttribution: Dries commentedCommitted to CVS HEAD. Thanks.
Comment #16
MikeBC CreditAttribution: MikeBC commentedSorry 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.
Comment #17
grendzy CreditAttribution: grendzy commentedMikeBC: 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.
Comment #18
MikeBC CreditAttribution: MikeBC commentedThanks--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 tablei just tacked "xymail.facebook.com" on the end in phpmyadmin.
Comment #19
crehnelt CreditAttribution: crehnelt commentedHi!
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
Comment #20
andypostFollow-up D7 patch #809132: Increase size of init field on users table to 254 characters
Comment #21
andypostLet's re-open this issue! Maybe Gabor agree with schema changes in D6 for this case...
Comment #22
marvil07 CreditAttribution: marvil07 commentedThis patch includes changes from #502968-12: Increase maximum allowable length of email addresses and #809132-19: Increase size of init field on users table to 254 characters ported to D6.
Comment #24
pdumais42 CreditAttribution: pdumais42 commentedI 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
Comment #25
pdumais42 CreditAttribution: pdumais42 commentedCrap. Rolled a new version. Last version was the one with the duplicate index error.
Comment #26
marvil07 CreditAttribution: marvil07 commented@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.
Comment #27
pdumais42 CreditAttribution: pdumais42 commentedWhen 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-
Comment #28
marvil07 CreditAttribution: marvil07 commentedComment #29
naxoc CreditAttribution: naxoc commentedI 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.