doubledee Posted December 24, 2011 Share Posted December 24, 2011 How big should I make my E-mail field? Right now I have it up to 40 characters, but maybe that isn't big enough?! Debbie Quote Link to comment Share on other sites More sharing options...
Pikachu2000 Posted December 24, 2011 Share Posted December 24, 2011 Are you talking about the database field? An email address can be up to 322 total characters. Quote Link to comment Share on other sites More sharing options...
scootstah Posted December 24, 2011 Share Posted December 24, 2011 Well, this is 40 characters: "myreallylongemail@thereallylongemail.com" So you decide. I'd probably bump it up to 60 or 80. Although emails can be much longer, that's not really normal. Quote Link to comment Share on other sites More sharing options...
doubledee Posted December 24, 2011 Author Share Posted December 24, 2011 Are you talking about the database field? An email address can be up to 322 total characters. I was asking as far as my HTML field, regular expression, and database field. All three! Debbie Quote Link to comment Share on other sites More sharing options...
doubledee Posted December 24, 2011 Author Share Posted December 24, 2011 Are you talking about the database field? An email address can be up to 322 total characters. Where do you get 322 characters? How long of an e-mail would you design for? Debbie Quote Link to comment Share on other sites More sharing options...
trq Posted December 24, 2011 Share Posted December 24, 2011 Take a look here: http://en.wikipedia.org/wiki/Email_address#Valid_email_addresses Most people won't have an email address above 60-80 chars, but they are still valid well over that longer than that. Quote Link to comment Share on other sites More sharing options...
doubledee Posted December 24, 2011 Author Share Posted December 24, 2011 Take a look here: http://en.wikipedia.org/wiki/Email_address#Valid_email_addresses Most people won't have an email address above 60-80 chars, but they are still valid well over that longer than that. The link you posted says... Syntax The format of email addresses is local-part@domain where the local-part may be up to 64 characters long and the domain name may have a maximum of 253 characters - but the maximum 256 characters length of a forward or reverse path restricts the entire email address to be no more than 254 characters.[1] - formally defined in RFC 5322 (sections 3.2.3 and 3.4.1) and by RFC 5321. Debbie Quote Link to comment Share on other sites More sharing options...
trq Posted December 24, 2011 Share Posted December 24, 2011 I know what it says, I have read it. Quote Link to comment Share on other sites More sharing options...
doubledee Posted December 24, 2011 Author Share Posted December 24, 2011 I know what it says, I have read it. Well apparently Pikachu2000 hasn't read it, because he said... An email address can be up to 322 total characters. Debbie Quote Link to comment Share on other sites More sharing options...
trq Posted December 24, 2011 Share Posted December 24, 2011 And.... ? Quote Link to comment Share on other sites More sharing options...
doubledee Posted December 24, 2011 Author Share Posted December 24, 2011 And.... ? And so apparently Pikachu2000 guess wasn't right... Debbie Quote Link to comment Share on other sites More sharing options...
trq Posted December 24, 2011 Share Posted December 24, 2011 So research the subject yourself. Quote Link to comment Share on other sites More sharing options...
scootstah Posted December 24, 2011 Share Posted December 24, 2011 If you're worried about it just use varchar(255). Quote Link to comment Share on other sites More sharing options...
doubledee Posted December 24, 2011 Author Share Posted December 24, 2011 If you're worried about it just use varchar(255). I was going to go with 60 characters actually. What do you think, scootstah? Debbie Quote Link to comment Share on other sites More sharing options...
scootstah Posted December 24, 2011 Share Posted December 24, 2011 Like I said, you will almost never see someone with an email 255 characters long. That's just absurd. Most people have short, easy to remember emails...so around 60-80 characters and you should be fine. If you ever get a complaint you can always increase it. Quote Link to comment Share on other sites More sharing options...
doubledee Posted December 24, 2011 Author Share Posted December 24, 2011 Like I said, you will almost never see someone with an email 255 characters long. That's just absurd. Most people have short, easy to remember emails...so around 60-80 characters and you should be fine. If you ever get a complaint you can always increase it. Then 60 it is. Thanks, Debbie Quote Link to comment Share on other sites More sharing options...
Pikachu2000 Posted December 24, 2011 Share Posted December 24, 2011 And.... ? And so apparently Pikachu2000 guess wasn't right... Debbie Guess? It wasn't a guess. I actually did some research on this some time ago and read the related RFCs that that define the format of an email address. If I missed a limiting factor in the calculation, then so be it. In the end, the number I provided was larger than the maximum characters in an email address. Setting a field's max size to that value would have no real, negative effect. Sure, a malicious user could enter an invalid email address longer than the actual limit, but so what? They could just as easily enter any invalid or otherwise non-existent address. Setting the field smaller, as you've done, does introduce the possibility of truncating an actual email address, thereby corrupting the data and rendering it useless. Quote Link to comment Share on other sites More sharing options...
doubledee Posted December 24, 2011 Author Share Posted December 24, 2011 And.... ? And so apparently Pikachu2000 guess wasn't right... Debbie Guess? It wasn't a guess. I actually did some research on this some time ago and read the related RFCs that that define the format of an email address. If I missed a limiting factor in the calculation, then so be it. In the end, the number I provided was larger than the maximum characters in an email address. Setting a field's max size to that value would have no real, negative effect. Sure, a malicious user could enter an invalid email address longer than the actual limit, but so what? They could just as easily enter any invalid or otherwise non-existent address. Setting the field smaller, as you've done, does introduce the possibility of truncating an actual email address, thereby corrupting the data and rendering it useless. Why are you and Thorpe going at me tonight?! I never judged either of your responses. I just commented on what each of you said. Geesh! Yes, I could truncate someone's e-mail, and maybe 70 or 80 characters would be better. But anything over 80 and I say, "Who cares?!" (I am of the mindset that you don't support difficult users...) Debbie Quote Link to comment Share on other sites More sharing options...
Pikachu2000 Posted December 24, 2011 Share Posted December 24, 2011 All I did was respond to your implication that the number I provided was purely arbitrary, and supply some additional, related facts. Quote Link to comment Share on other sites More sharing options...
scootstah Posted December 24, 2011 Share Posted December 24, 2011 In the end, the number I provided was larger than the maximum characters in an email address. Setting a field's max size to that value would have no real, negative effect. Except varchar can only go to 255 and not 322. ;P Quote Link to comment Share on other sites More sharing options...
doubledee Posted December 24, 2011 Author Share Posted December 24, 2011 All I did was respond to your implication that the number I provided was purely arbitrary, and supply some additional, related facts. That's for you and Thorpe to duke out. I never questioned your ability, and was just saying that Thorpe's max and yours and what I found online varied. Debbie Quote Link to comment Share on other sites More sharing options...
Pikachu2000 Posted December 24, 2011 Share Posted December 24, 2011 In the end, the number I provided was larger than the maximum characters in an email address. Setting a field's max size to that value would have no real, negative effect. Except varchar can only go to 255 and not 322. ;P I don't recall mentioning using a varchar field type. And even so, the limit is 65,534 bytes in MySQL >= 5.0.3. Quote Link to comment Share on other sites More sharing options...
doubledee Posted December 24, 2011 Author Share Posted December 24, 2011 In the end, the number I provided was larger than the maximum characters in an email address. Setting a field's max size to that value would have no real, negative effect. Except varchar can only go to 255 and not 322. ;P Actually, after MySQL 5.0.3 a VARCHAR could go from 0-65,535 (Or at least that is what I found online?!) (I wonder when you would want to go to TEXT() versus a large VARCHAR?? From what I have read, VARCHAR() blows TEXT() out of the water when it comes to query speeds...) And if I was going to store messages (e.g. Success/Failure message), I wonder which would make more sense? Debbie Quote Link to comment Share on other sites More sharing options...
scootstah Posted December 24, 2011 Share Posted December 24, 2011 And even so, the limit is 65,534 bytes in MySQL >= 5.0.3. Actually, after MySQL 5.0.3 a VARCHAR could go from 0-65,535 Huh. So it is. Interesting. (I wonder when you would want to go to TEXT() versus a large VARCHAR?? From what I have read, VARCHAR() blows TEXT() out of the water when it comes to query speeds...) VARCHAR stores data in the row, whereas TEXT/BLOB is just a reference to another location where the data is stored. Therefore, TEXT/BLOB only contributes a very small amount to the row size. VARCHAR has a maximum size of the row size - so it's only 0-65,353 if it's the only column in the row. The speed of VARCHAR vs TEXT/BLOB is highly situational. If you have a small amount of data (such as an email address) then VARCHAR should be faster. If you have a blog article, obviously TEXT is a better option. And if I was going to store messages (e.g. Success/Failure message), I wonder which would make more sense? Like I said, if you are putting that huge chunk in there I would go with a TEXT. But, I still think this is a bad approach. Quote Link to comment Share on other sites More sharing options...
ManiacDan Posted December 24, 2011 Share Posted December 24, 2011 Why are you and Thorpe going at me tonight?! I never judged either of your responses. I just commented on what each of you said. Geesh! You said he was wrong. You don't think "I guess he was wrong" is being judgmental? As a personal policy I've been ignoring your little tantrums on here, but this is just ridiculous. You told an expert he was wrong when he was absolutely correct. If you're so smart, why are you asking us? Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.